最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugin development - Wordpress custom url without using any of the custom tags given

programmeradmin2浏览0评论

I have a url like this:

www.domainname/product/productname which obviously uses a wordpress custom postlink using the custom tags given to me (%postname% as my products are just custom post types) however I would like it to be www.domainname/[metaproperty1]/[metaproperty2][metaproperty3]

where meta property 1 and 2 are taxonomies that relate to sale status and location of product and meta property 3 is an id (but crucially not the post id - it's an id generated by an API that an importer uses to add products to the DB) so essentially I need to programatically set the new permalink. Any clues? I'm currently looking at using the register_post_type function to register my custom post type with the 'rewrite' option and including placeholders like %metaproperty1% etc etc. that would be swapped out later on with the

$wp_rewrite->add_rewrite_tag

function, is this the correct way of thinking about it?

发布评论

评论列表(0)

  1. 暂无评论