How can we help?

If you are looking for support for our PokaTheme, this is the place!

Home Forums FAQ How to change URL structure or remove slug of Reviews CPT

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1920
    admin
    Keymaster

    How to change slug on Review pages (Change ‘review’ slug)

    You can add the following snippet inside functions.php of your child theme:
    *Change the ‘affiliatesnewslug’ with your own slug.

    add_filter( 'register_post_type_args', 'change_slug_affiliates_cpt', 10, 2 );
    function change_slug_affiliates_cpt( $args, $post_type ) {
    
        if ( $post_type == 'affiliates') {
            $args['rewrite']['slug'] = 'affiliatesnewslug';
        }
    
        return $args;
    }

    —————————————————————————–

    How to change slug on Review taxonomies (Change ‘list’ slug)

    You can add the following snippet inside functions.php of your child theme:
    *Change the ‘newslug’ with your own slug.

    add_filter( 'register_taxonomy_args', 'change_slug_affiliates_tax', 10, 2 );
    function change_slug_affiliates_tax( $args, $taxonomy ) {
    
        if ( $taxonomy == 'lists') {
            $args['rewrite']['slug'] = 'newslug';
        }
    
        return $args;
    }

    —————————————————————————–

    How to remove the slug from the URL structure of Reviews

    You can use one of the following plugins Remove slug from custom post type or Remove CPT base
    However because WordPress require slug to the URL to identify if it is a post/page or post from a CPT, if a post/page has the same URL with a post from the Review CPT there is going to be conflict.
    Also the AMP versions of the Reviews the URL structure will be http://www.siteurl.com/review-name/?amp and not http://www.siteurl.com/review-name/amp

    —————————————————————————–

    How to remove the slug from the URL structure of Review taxonomies

    You can use the following plugin : Remove Taxonomy Base Slug
    After downloading and activating the plugin go to Plugins -> Remove Taxonomy Base Slug and select “lists” and click “Apply changes”.
    Last step is to go to Settings -> Permalinks and click “Save changes” to refresh the Permalinks.
    Also be aware that conflicts may appear due to same URL.

    • This topic was modified 5 years, 10 months ago by admin.
    • This topic was modified 5 years, 10 months ago by admin.
    • This topic was modified 5 years, 10 months ago by admin.
    • This topic was modified 5 years, 10 months ago by admin.
    • This topic was modified 3 years, 5 months ago by admin.
Viewing 1 post (of 1 total)
  • The forum ‘FAQ’ is closed to new topics and replies.