search ]

Disabling Automatic Redirects in Yoast SEO Premium

Yoast SEO Premium Redirects Manager allows for automatic redirection when any URL on your site changes. In most cases, this is an excellent option, and you’d want to keep those redirects. However, there are situations where you may prefer to disable this option.

For an article about the Yoast plugin and its settings, take a look at the following post.

Before we proceed, if you’re not familiar with how the Premium version’s Redirects Manager looks, here is an image:

Yoast Premium Redirects Manager

Disabling Automatic Creation of Redirects

Yoast SEO Premium monitors URL changes and creates redirects automatically. This redirection prevents instances where a visitor to your site lands on a 404 error page. However, you can disable this option by adding the following code to your child theme’s functions.php file.

A. For Pages and Posts

add_filter( 'wpseo_premium_post_redirect_slug_change', '__return_true' );

B. For Taxonomies (Categories, Tags, etc.)

add_filter( 'wpseo_premium_term_redirect_slug_change', '__return_true' );

Disabling Notices on Redirects

When you delete content on your site, the plugin displays a notification to add a redirect for the deleted content (content can be any custom post type on your site).

The intention is to disable the appearance of those notices about redirecting, although the redirects will still be performed.

If you want to disable these notices, add the following code to your child theme’s functions.php file:

1. For Pages and Posts that were moved to the trash

add_filter( 'wpseo_enable_notification_post_trash', '__return_false' );

2. For Pages and Posts whose URL you changed

add_filter( 'wpseo_enable_notification_post_slug_change', '__return_false' );

3. For Taxonomies that were moved to the trash

add_filter( 'wpseo_enable_notification_term_delete', '__return_false' );

4. For Taxonomies whose URL you changed

add_filter( 'wpseo_enable_notification_term_slug_change', '__return_false' );
0 Comments...

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!

Savvy WordPress Development