Question About “Strip Category Base” with Custom Post Type Slugs

#980194
  • Resolved Alexander Reznik
    Rank Math free

    Dear Rank Math Team,

    I’m using your plugin and have a question regarding the “Strip Category Base” feature. Does this also work for custom post type slugs defined via the ACF plugin?

    Specifically, I would like to transform URLs from:
    domain.com/slug (e.g., movies)/postname (e.g., batman)
    to
    domain.com/batman

    Unfortunately, I haven’t been able to achieve this on my own. I would appreciate any guidance on whether this is possible with Rank Math and how to set it up.

    Thank you in advance!

    Best regards,
    Alex

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    We apologize for the issue you are facing with the "Strip Category Base" feature in Rank Math. The "Strip Category Base" option primarily affects the category archive URLs for standard post types and does not directly apply to custom post types created via plugins like ACF.

    To achieve the URL transformation you desire (from domain.com/slug/postname to domain.com/postname), you may need to customize the permalink structure for your custom post types. Here’s a general approach you can take:

    1. Custom Post Type Registration: When registering your custom post type, ensure that you set the rewrite argument correctly. For example:

      register_post_type('movies', array(
         'rewrite' => array('slug' => ''),
         // other arguments
      ));

      This will remove the base slug from the URL.

    2. Flush Rewrite Rules: After making changes to your custom post type registration, make sure to flush the rewrite rules. You can do this by visiting the Settings → Permalinks page in your WordPress dashboard and simply clicking Save Changes.

    3. Rank Math Settings: Ensure that you have enabled the appropriate settings in Rank Math for handling permalinks and redirections if necessary.

    If you continue to experience issues or need further assistance, please reply to this ticket with your site URL, and a human agent from our support team will be happy to assist you further.

    Thank you for raising this concern!

    Sources:
    How to Remove the Category Base From WordPress » Rank Math
    WordPress Permalink Structure & Changing Individual URLs » Rank Math

    Hello,

    Thank you for contacting us and bringing your concern to our attention.

    The “Strip Category Base” option in Rank Math only works with the WordPress default categories which removes the /category/ slug from the default categories.

    Unfortunately, it will not work on the CPT. In this case, if you want, you can use a plugin like Permalink Manager to change the permalink of your CPT.

    Please don’t hesitate to let us know if you have any other questions.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

The ticket ‘Question About “Strip Category Base” with Custom Post Type Slugs’ is closed to new replies.