This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Ambrosite Unlink Parent Categories

Description

When activated, this plugin unlinks parent categories (that is, categories that have child categories underneath them in a hierarchy) in category menus and lists. It affects the output of wp_list_categories, as well as all plugins and widgets that use that function.

The plugin works by turning the parent category links into ‘dummy links’. That is, it replaces the href attribute on parent menu items with a ‘#’ (hash/pound) mark. A dummy link is just like a regular link, except that it leads back to the current page when clicked. The dummy links are given an inline style “cursor: default” to prevent the mouse pointer from turning into a hand when hovering over unlinked menu items.

The plugin is compatible with custom hierarchical taxonomies. To create a list of custom taxonomy terms, you must set the ‘taxonomy’ parameter of wp_list_categories. See the FAQ for more information.

Options

To configure the plugin options, go to the Settings menu in the WordPress admin panel and click on ‘Unlink Parent Categories’.

Use Dummy Links
If you uncheck this box, the plugin will unlink the parent categories by replacing the anchor tags with span tags. In some themes, this may cause problems with CSS styling. In order to fix this, you would need to add an additional selector to any rule that targets the anchor tags (see the FAQ for more information). If you are not experienced in writing CSS selectors, then it is strongly recommended to stick with dummy links.

Unlink Current Category
Unlink the current category, in addition to the parent categories.

Remove Link Titles
Remove the title attribute from the links (stops the tooltip from popping up when the mouse hovers over the menu items). This doesn’t have anything to do with unlinking parent categories, but it’s something a lot of people want, so I decided to include it.

Unlink Specific Categories
You can specify which categories you want unlinked, using a comma-separated list of category IDs (example: 3,7,31). If you want only the specified categories to be unlinked, then check the “Unlink specific categories only” box.

Screenshots

  • The Unlink Parent Categories configuration page

Installation

  • Upload ambrosite-unlink-parent-categories.php to the /wp-content/plugins/ directory.
  • Activate the plugin through the Plugins menu in WordPress.
  • All parent categories in menus created with wp_list_categories will become unlinked as soon as the plugin is activated. It will also automatically unlink newly created parent categories as the category hierarchy is built.
  • Go to the Settings menu in the WordPress admin panel, and click on Unlink Parent categories to configure the plugin options.

FAQ

I installed the plugin but it does not seem to be working. Why?

Unlink Parent Categories only affects the output of wp_list_categories. If your menu is not being generated by that functions, then the plugin will not work. If you want to test whether this is an issue with your menu, put the default ‘Categories’ widget into your sidebar. The Categories widget uses wp_list_categories, so if the parent categories are unlinked there, but not in your navigation menu, it means that your menu is not using wp_list_categories.

How can I use this plugin with custom taxonomies?

You must set the ‘taxonomy’ parameter of wp_list_categories in order to generate a list of custom taxonomy terms, as explained in the WordPress Codex:

https://codex.wordpress.org/Template_Tags/wp_list_categories#Display_Terms_in_a_custom_taxonomy

Once the taxonomy parameter is set, the plugin will unlink the parent terms in the list, just as it does with normal categories. You can also set a custom taxonomy for the default Categories widget, by putting the following code into functions.php:

function wc_args( $cat_args ) {
        $cat_args['taxonomy'] = 'my_taxonomy';
        return $cat_args;
}
add_filter('widget_categories_args', 'wc_args');
I do not want to use dummy links. How can I fix my menu styles when the parent categories are unlinked?

If you uncheck ‘Use Dummy Links’, the plugin will unlink the parent categories by replacing the anchor tags with span tags. In some themes, this may cause styling problems if there are CSS selectors targeting the anchor tags that have been removed. In order to fix this, you must add an additional selector to any rule that targets the anchor tags. The CSS rules are different for every theme, so I cannot give specific instructions. As a general example, if your menu styles look like this:

#menu li a {
    some styles ...
}

Then you would need to add an additional selector which targets the span:

`#menu li span,

menu li a {

some styles …
}`

Reviews

not working

Sound like what I was searching for, but unfortunately the plugin is not working with current WP version and need to updated.

Read all 1 review

Contributors & Developers

“Ambrosite Unlink Parent Categories” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.0

  • Initial version.