Remove the Link in a Breadcrumb

A topic that comes up time to time in support requests is how to unlink a breadcrumb. Typically this is due to having an empty page that exists to facilitate a logical hierarchy. Naturally, linking to this blank page in the breadcrumb trail is not useful. While it is bad form to have a breadcrumb in the breadcrumb trail that is not linked, there is a filter that can facilitate this behavior.

The presented solution is a simplistic example for a single page. However, it can be extended for multiple pages, or taxonomy terms. Finally, rather than being hard-coded, the IDs could come from a post_meta/term_meta field.

The Code (Breadcrumb NavXT 6.5)

Introduced in Breadcrumb NavXT 6.5, the bcn_breadcrumb_linked filter makes changing the linked status quite simple:

add_filter('bcn_breadcrumb_linked', 'my_breadcrumb_url_stripper', 3, 10);
function my_breadcrumb_url_stripper($linked, $type, $id)
{
	if(in_array('post-page', $type) && (int) $id === MYPAGEID)
	{
		return false;
	}
	return linked;
}

The Code (Pre-Breadcrumb NavXT 6.4)

Due to changes introduced in Breadcrumb NavXT 6.4, the below only works with versions of Breadcrumb NavXT prior to 6.4:

add_filter('bcn_breadcrumb_url', 'my_breadcrumb_url_stripper', 3, 10);
function my_breadcrumb_url_stripper($url, $type, $id)
{
	if(in_array('post-page', $type) && (int) $id === MYPAGEID)
	{
		$url = NULL;
	}
	return $url;
}

After placing this code into your site specific plugin, you will need to update one part of it. Just replace MYPAGEID with the ID of the page you want to remove the link to. That’s it. Simple, right?

-John Havlik

[end of transmission, stay tuned]

Breadcrumb NavXT bbPress Extensions 1.1.0

Announcing the immediate availability of Breadcrumb NavXT bbPress Extensions 1.1.0. This version add support for listing the current forum’s breadcrumb when viewing a single topic instance. Additionally, bbPress Extensions will no longer swap out the topics archive breadcrumb for the forums archive breadcrumb when on a topic archive. These two changes facilitate the generation of more accurate, and specific, breadcrumbs for bbPress resources.

You can grab the latest Breadcrumb NavXT bbPress Extensions on the Breadcrumb NavXT bbPress Extensions page. Also, checkout the GitHub repository for Breadcrumb NavXT bbPress Extensions for the latest development builds.

-John Havlik

[end of transmission, stay tuned]

WP Lynx 1.1.2

What’s this? Another bugfix release for WP Lynx? That’s right, announcing the immediate availability of the second bug fix release for WP Lynx 1.1. Two bugs were squashed in this release.

In 1.1.1, one of two bugs afflicting the uninstaller was fixed. However, there was still another bug that caused uninstalls to not work, this has been fixed in 1.1.2. And, to ensure this doesn’t slip through the cracks again, unit tests for the uninstaller were generated for this release. Additionally, a bug that caused permission issues when saving settings was fixed in this release.

You can grab the latest WP Lynx on the WP Lynx WordPress.org plugin page.

-John Havlik

[end of transmission, stay tuned]