Wordpress plugins
Single Category Permalink

Single Category Permalink

Version : 2.2
Tested up to : 4.7.6
Number of download : 14722
Author : Scott Reilly
Average rating : 5 / 5 on 2 votes 2 votes, 5 avg.rating

Screenshots

Single Category Permalink
Single Category Permalink
Single Category Permalink
Single Category Permalink

Reduce permalinks (category or post) that include entire hierarchy of categories to just having the lowest category in the hierarchy. By default, WordPress replaces the %category% permalink tag in a custom permalink structure with the entire hierarchy of categories for the post’s first matching category. For example, assuming your site has a hierarchical category structure like so: Applications |_ Desktop |_ Web |_ WordPress By default, if you have a permalink structure defined as %category%/%year%/%monthnum%/%day%/%postname%, your post titled “Best Plugins” assigned to the “WordPress” category would have a permalink of: http://www.example.com/applications/web/wordpress/2008/01/15/best-plugins If you activate the Single Category Permalink plugin, this would be the permalink generated for the post (and recognized by the blog): http://www.example.com/wordpress/2008/01/15/best-plugins In order for a category to be used as part of a post’s permalink structure, %category% must be explicitly defined in the Settings -> Permalinks admin page as part of a custom structure, i.e. /%category%/%postname%. For category links, %category% is implied to follow the value set as the “Category base” (or the default category base if none is specified). So if your category base is ‘category’, the above example would list posts in the ‘WordPress’ category on this category listing page: http://www.example.com/category/applications/web/wordpress/ With this plugin activated, that link would become: http://www.example.com/category/wordpress/ NOTE: The fully hierarchical category and post permalinks will continue to work. The plugin issues a 302 redirect to browsers and search engines pointing them to the shorter URL. Links: Plugin Homepage | Plugin Directory Page | Author Homepage Filters The plugin exposes one filter for hooking. Typically, customizations utilizing this hook would be put into your active theme’s functions.php file, or used by another plugin. c2c_single_category_redirect_status (filter) The ‘c2c_single_category_redirect_status’ hook allows you to specify an HTTP status code used for the redirect. By default this is 302. Arguments: $status (integer) : The default HTTP status code Example: // Change single category redirect to 302 /** * Change the redirection HTTP status to a 302. * * @param int $code The HTTP status code. By default 301. * @return int */ function scp_change_redirect_status( $code ) { return 302; } add_filter( 'c2c_single_category_redirect_status', 'scp_change_redirect_status' );

Download now