• Resolved lauratraveler

    (@lauratraveler)


    Hi! Up until recently, I used the Yoast plugin with ‘Remove the categories prefix’ set to ‘Yes’.

    Now that I deactivated the plugin, my category pages have the /category/ prefix all of a sudden. And I want to remove the /category/ prefix so the URL of the category doesn’t look different to Google.

    So I’ve tried adding this function:

    function remove_category( $string, $type )  {           if ( $type != 'single' && $type == 'category' && ( strpos( $string, 'category' ) !== false ) )          {              $url_without_category = str_replace( "/category/", "/", $string );              return trailingslashit( $url_without_category );          }      return $string;  }     add_filter( 'user_trailingslashit', 'remove_category', 100, 2);  
    

    to my functions.php in my child theme but it isn’t working. Is there something that Yoast leaves behind that stops this function from working?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • We can confirm that Yoast SEO doesn’t leave behind anything when disabling the plugin. So, if the relevant custom code isn’t working for you, there’s must be something else going on or you’ll need to implement the code correctly/differently.

    We are afraid to say that we won’t be able to offer the relevant custom code here as it’s not related to Yoast SEO, nor we offer any assistance when it comes to custom code implementation.

    We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue.

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

The topic ‘Remove the categories prefix on plugin removal’ is closed to new replies.