Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return noindex, nofollow when wpseo_robots is false #18488

Merged
merged 3 commits into from
Sep 20, 2022

Conversation

mmikhan
Copy link
Member

@mmikhan mmikhan commented May 25, 2022

Context

  • When add_filter( 'wpseo_robots', '__false' ); is set, noindex, nofllow isn't shown but only max-image-preview:large is being shown, which is wrong. When the relevant filter is set to false, it shall output noindex, nofollow to discourage search engine crawling the entire site.

Summary

This PR can be summarized in the following changelog entry:

  • Fixes a bug where passing __false to the wpseo_robots filter would result in a max-image-preview:large robots meta directive instead of the desired noindex, nofollow directive.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Set add_filter('wpseo_robots', '__return_false'); on functions.php file.
  • Check the robots meta output on the front-end of the website to look for noindex, nofllow.

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

Quality assurance

  • I have tested this code to the best of my abilities
  • I have added unittests to verify the code works as intended

Fixes #18483

@mmikhan mmikhan changed the title Return noindex, nofllow when wpseo_robots is false Return noindex, nofllow when wpseo_robots is false May 25, 2022
@mmikhan mmikhan added the changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog label Aug 4, 2022
@jdevalk
Copy link
Contributor

jdevalk commented Sep 20, 2022

LGTM, needs acceptance testing.

Also, let's check our code for cases where we return false on this and why we do.

@enricobattocchi enricobattocchi added this to the 19.8 milestone Sep 20, 2022
@enricobattocchi enricobattocchi changed the title Return noindex, nofllow when wpseo_robots is false Return noindex, nofollow when wpseo_robots is false Sep 20, 2022
@enricobattocchi enricobattocchi changed the base branch from trunk to release/19.8 September 20, 2022 15:57
@enricobattocchi
Copy link
Member

Acceptance test OK! Changing target to 19.8 to include this in our next release

@enricobattocchi enricobattocchi merged commit 8ddcd6d into Yoast:release/19.8 Sep 20, 2022
@mmikhan mmikhan deleted the 18483 branch September 20, 2022 16:12
@LoganStrike
Copy link

FYI, the code snippets on the following page from a Yoast support engineer show how to remove the Yoast robots tag by returning false. But the change in this PR resulted in a noindex,nofollow robots tag when returning false, instead of suppressing the robots tag altogether.

https://gist.github.com/amboutwe/0c71e42aa164238007d7ea88f174a93f

This is a huge breaking change considering the impact on SEO for sites that previously used this filter to remove the Yoast robots tag. Those sites/pages went from having no robots tag to having a noindex,nofollow robots tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Returning false from wpseo_robots causes robots to be max-image-preview:large
4 participants