admin管理员组文章数量:1312662
I want to add prefix or suffix to all post_tag
slugs.
For example one tag URL: example/tag/post-tag-slug
all such URLs should be suffixed with a suffix: example/tag/post-tag-slug-suffix
.
I want to add prefix or suffix to all post_tag
slugs.
For example one tag URL: example/tag/post-tag-slug
all such URLs should be suffixed with a suffix: example/tag/post-tag-slug-suffix
.
- What have you already tried? – Max Yudin Commented Mar 1, 2017 at 9:05
1 Answer
Reset to default 1We can do this by following code:
function custom_tag_rewrite()
{
add_rewrite_rule("^tag/(.+)-suffix/?$", 'index.php?post_type=post&tag=$matches[1]', 'top');
flush_rewrite_rules();
}
add_action('init', 'custom_tag_rewrite');
and try open like this http://example/tag/post-tag-slug-suffix
本文标签: tagsHow to add prefix or suffix to posttag slug
版权声明:本文标题:tags - How to add prefix or suffix to post_tag slug? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741902243a2403936.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论