• Hi everyone!
    I’m working with a premium theme in which was developed a plugin for custom post types. The site presents a listing of events and locations. I’d like to change the permalink structure for SEO purposes and maybe I’m not so experienced in coding to understand how to achieve my goal (if possible).

    This is the code for events categories:

    register_taxonomy(
    				'event_cat',
    				'event',
    				array(
    					'public'=>true,
    					'hierarchical' => true,
    					'labels'=> $labels,
    					'query_var' => 'event_cat',
    					'show_ui' => true,
    					'rewrite' => array( 'slug' => 'event_cat', 'with_front' => false ),
    				)
    			);

    And this is the permalink output:
    http://www.vadoper.it/demo/event_cat/concerto-dal-vivo/
    I’d like to get rid of this “event_cat” (I was expecting to see it substituted by the category name, but this is appended after “event_cat” instead) just to have a simple permalink for categories like .

    Maybe I’m missing something about the theme architecture and, even for instructive purposes, I hope someone could help me understand more about these permalinks.

    My try has been changing the “rewrite” code with 'rewrite' => array( 'slug' => '', 'with_front' => false ),
    re-save permalinks (actually setted to /%postname%/) but it isn’t working..
    Thank you!

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You need to have some sort of constant text for the rewrite rule to be able to identify that the permalink is for a custom taxonomy term and not, for example, a post title. It doesn’t need to exist in front of the term, but it needs to exist somewhere.

    It’s possible to have positionally based permalinks, but then that position must always be attributed to the taxonomy term no matter what. In such a case you are creating a custom permastruct with a custom tag instead of a normal rewrite rule.

    I don’t know if it would help with SEO, but you could add the term as an URL parameter instead of creating a permalink, i.e. index.php?event_cat=5 (5 is an example term ID), then register the URL parameter in Google Search Console. Bing Webmaster Tools should have something similar. Of course this only helps with search engines where the parameter is registered.

    Implementing any of these variants could involve hacking the theme or it’s plugin. This would be problematic because your changes could be lost when the theme or plugin is updated. Ideally, you need to achieve your changes through your own plugin that hooks various actions and filters to achieve your goals.

Viewing 1 replies (of 1 total)

The topic ‘Custom Post Type Rewrite Permalink’ is closed to new replies.