Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.77k stars 891 forks source link

Automatic 301 Redirect Notices Disabled, Still show for custom post types #18084

Closed blizam closed 2 years ago

blizam commented 2 years ago

Please give us a description of what happened.

We have this set (I believe this is the pertinent one):

add_filter('wpseo_enable_notification_post_trash', '__return_false');

We use a LMS plugin that has the custom post type of _gb_xapicontent. When these posts are moved to the trash we get the Yoast notifcations about creating a 301 redirect for the post

We have all the hooks set for disabling these, not just the above

/Automatic/ //Posts and Pages add_filter('wpseo_premium_post_redirect_slug_change', 'return_true' ); //Taxonomies add_filter('wpseo_premium_term_redirect_slug_change', 'return_true' ); /Notifications/ //Posts or Pages: Moved to Trash add_filter('wpseo_enable_notification_post_trash', 'return_false'); //Posts or Pages: Change URL add_filter('wpseo_enable_notification_post_slug_change', 'return_false'); //Taxonomies: Moved to Trash add_filter('wpseo_enable_notification_term_delete','__return_false'); //Taxonomies: Change URL add_filter('wpseo_enable_notification_term_slug_change','__return_false');

Please describe what you expected to happen and why.

We would like to suppress this behavior, we do not want any backend notifications from Yoast about creating 301s when posts, pages, taxonomies, etc are trashed.

How can we reproduce this behavior?

  1. Create a post of a custom post type and trash it with the above hooks set
  2. We have other custom post types on the site... products (WooCommerce), other plugins... I'm unsure why it's only occurring for this particular custom post type: gb_xapi_content
  3. This is the plugin that generates the post type... but it's standard WP post type, nothing special: https://www.nextsoftwaresolutions.com/grassblade-xapi-companion/

Technical info

Used versions

Djennez commented 2 years ago

@blizam those look like outdated filter handles. Please see our docs for the current and correct ones. I tested add_filter('Yoast\WP\SEO\enable_notification_post_trash', '__return_false'); which also worked for my custom posttype.

blizam commented 2 years ago

TY!