Custom Post slug and nav_menu_item slug collisions
-
Hello ??
I’m developping some plugin with custom post types and I’m now running into a weird problem.
I have a custom type called, let’s say, “My Custom Post”. I want a list of those to be reachable at a convenient URL, so I set up my rewrite slug like this :
'rewrite' => array( 'slug' => 'my-custom-posts', )
Good. Now I want to use a custom Menu to handle all of this, so I start building it. Now I want an item called “My Custom Posts”, which slug will be “my-custom-posts” and pointing to /my-custom-posts/ (my plugin handles this and provides a listing page if pagename is found).
Now the problem : if I click on my Menu’s item, I’m redirected to my default Permalink rewrite rule, pointing to the nav_menu_item’s ID, not having even the chance to do anything with it.
I tried a few tricks, but nothing seems to work . Except changing my Custom Post slug. The best solution would be to tell WordPress to ignore nav_menu_item post type, as it will always point to a “Post not found page”, but I couldn’t manage to do that.
- The topic ‘Custom Post slug and nav_menu_item slug collisions’ is closed to new replies.