The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Remove Parent Categories from Category URL (6 posts)

  1. Burke Ingraffia
    Posted 5 years ago #

    Since I upgraded to 3.1 I have had an issue with my category URLs.

    In 3.0.5 (using All-in-one-SEO) if I had parent categories like


    The URL would be http://www.mysite.com/category/child/

    Now it's back to showing the parents. Did something change in the wp-includes/category-template.php file?

    How do I remove parent categories from the urls?

  2. mr_doinel
    Posted 5 years ago #

    I have got exactly the same issue.
    Is it possible to remove the parent category from the url with WordPress 3.1 ?

  3. mr_doinel
    Posted 5 years ago #

    Any ideas about this new issue ?

  4. mr_doinel
    Posted 5 years ago #

    I finally find a way to change this!

    Put this code in your functions.php fiel :

    add_action( 'init', 'build_taxonomies', 0 );  
    function build_taxonomies() {
      register_taxonomy( 'category', 'post', array(
    		'hierarchical' => true,
    	 	'update_count_callback' => '_update_post_term_count',
    		'query_var' => 'category_name',
    		'rewrite' => did_action( 'init' ) ? array(
    					'hierarchical' => false,
    					'slug' => get_option('category_base') ? get_option('category_base') : 'category',
    					'with_front' => false) : false,
    		'public' => true,
    		'show_ui' => true,
    		'_builtin' => true,
    	) );

    Setting the hierarchical parameter of the rewrite parameter to false does the job perfectly! :)

  5. Burke Ingraffia
    Posted 5 years ago #

    That worked, but the way it was before I switched to 3.1 was that if you did land on


    It would redirect to


    Thanks for the tip - I love learning.

  6. ballhogjoni
    Posted 4 years ago #

    awesome dude, just what I was looking for :)

Topic Closed

This topic has been closed to new replies.

About this Topic