Remove the categories prefix on plugin removal
-
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)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Remove the categories prefix on plugin removal’ is closed to new replies.