admin管理员组文章数量:1300261
Consider the two following custom post types:
- Museums
- Bakeries
With one shared taxonomy:
- Region
I'm using rewrite rules to improve the URL structure, so I can serve pages to visitors such as:
- (all museums in London)
- (all bakeries in Birmingham)
- (a specific bakery in London)
Here are the rewrite rules:
function my_url_rewrite_rule() {
add_rewrite_rule( '^museums/([^/]+)/?$',
'index.php?taxonomy=region&post_type=museums&term=$matches[1]', 'top' );
add_rewrite_rule( '^museums/([^/]+)/page/([0-9]+)?$',
'index.php?post_type=museums&genre=$matches[1]&paged=$matches[2]', 'top' );
add_rewrite_rule( '^bakeries/([^/]+)/?$',
'index.php?taxonomy=region&post_type=bakeries&term=$matches[1]', 'top' );
add_rewrite_rule( '^bakeries/([^/]+)/page/([0-9]+)?$',
'index.php?post_type=bakeries&genre=$matches[1]&paged=$matches[2]', 'top' );
}
add_action( 'init', 'my_url_rewrite_rule', 10, 0 );
I have set up my templates and everything works fine, with one exception: I can't get the following type of pages into my sitemap:
.. And every other combination of url+post_type+taxonomy. I can access the URLs and have working templates, but I just can't get the sitemap to understand the new structure. This is not surprising as I'm bypassing the default url structure of Wordpress. But how can I proceed to get them into the sitemap?
I'm using SEOPress (Pro), but I've also tried with Yoast.
Thanks!
本文标签: custom taxonomyHow do I get WordPress URL rewrites into Sitemap
版权声明:本文标题:custom taxonomy - How do I get WordPress URL rewrites into Sitemap? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741659432a2390948.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论