admin管理员组文章数量:1123509
I used JetEngine for my custom post types. I have a problem before about rewriting the slug of a custom post type and I managed to fix it using register_post_type_args
here(here is the previous question). But after I get to fix it, I can no longer access the existing pages like Contact Us
but I can access the pages that handles the products and the homepage. I tried removing my code from functions.php
and I can access the Contact us
page so I am positive my code was the culprit. Below is my code on how I achieved the rewriting of slug of the custom post type.
function manufacturer_post_type_link($link, $post) {
if ( 'manufacturers' == get_post_type( $post ) ) {
$manufacturer = get_the_terms($post->ID, 'manufacturer-categories');
$manufacturerslug = $manufacturer[0]->slug;
$link = str_replace('%manufacturer-categories%', $manufacturerslug, $link);
}
return $link;
}
add_filter('post_type_link', 'manufacturer_post_type_link', 1, 3);
add_filter( 'register_post_type_args', 'manufacturers_register_post_type_args', 10, 2 );
function manufacturers_register_post_type_args( $args, $post_type ) {
if ( 'manufacturers' === $post_type ) {
$args['rewrite']['slug'] = '%manufacturer-categories%';
}
return $args;
}
Can someone help me point out where is that I need to edit? Any help is appreciated. Thank you so much.
EDIT: This is how it looks like on my JetEngine Post Types tab,
本文标签: phpCannot access the other pages after successfully editing post type
版权声明:本文标题:php - Cannot access the other pages after successfully editing post type 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736577042a1944877.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论