简体   繁体   中英

Wordpress custom post type rewrite url same as a current page

I have created a custom taxonomy and post type.

I have a page using a custom template at 'support/links', which has some functionality including links to my custom post type.

Using:

'rewrite' => array('slug' => 'support/links')

does not work. I'm guessing because of a conflict with the page.

'rewrite' => array('slug' => 'support/links2')

works fine. Any ideas how I can get this to work, or if there is a better way to approach this?

Every slug must be globally unique in WordPress across all taxonomies. The "links" slug already exists which is why it is not working for you while "links2" does. My suggestion would be to go with something that does not conflict such as "weblinks", "quicklinks", etc...

'rewrite' => array( 'slug' => 'support/weblinks' )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM