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