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

Use wp_robots() instead of noindex() in WP 5.7 #5793

Merged
merged 1 commit into from
Jan 21, 2021

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented Jan 21, 2021

Summary

The noindex() function is now deprecated in favor of wp_robots() as of WP 5.7-alpha.

See https://core.trac.wordpress.org/ticket/51511 and https://core.trac.wordpress.org/changeset/49992

Checklist

  • My pull request is addressing an open issue (please create one otherwise).
  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@westonruter westonruter added this to the v2.0.11 milestone Jan 21, 2021
@github-actions
Copy link
Contributor

Plugin builds for d167936 are ready 🛎️!

@codecov
Copy link

codecov bot commented Jan 21, 2021

Codecov Report

Merging #5793 (d167936) into develop (d9add69) will decrease coverage by 0.00%.
The diff coverage is 66.66%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #5793      +/-   ##
=============================================
- Coverage      74.23%   74.23%   -0.01%     
  Complexity      5498     5498              
=============================================
  Files            201      201              
  Lines          16626    16628       +2     
=============================================
+ Hits           12343    12344       +1     
- Misses          4283     4284       +1     
Flag Coverage Δ Complexity Δ
javascript 75.84% <ø> (ø) 0.00 <ø> (ø)
php 74.18% <66.66%> (-0.01%) 0.00 <0.00> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
includes/amp-post-template-functions.php 97.22% <66.66%> (-2.78%) 0.00 <0.00> (ø)

@westonruter westonruter added the WS:Core Work stream for Plugin core label Jan 21, 2021
@westonruter westonruter merged commit 9f14d61 into develop Jan 21, 2021
@westonruter westonruter deleted the fix/wp-robots-legacy-post-template branch January 21, 2021 08:00
westonruter added a commit that referenced this pull request Jan 21, 2021
…rl-customization

* 'develop' of github.com:ampproject/amp-wp:
  Use wp_robots() instead of noindex() in WP 5.7 (#5793)
  Bump eslint-plugin-jsdoc from 31.0.3 to 31.0.4
  Bump google/cloud-storage from 1.23.0 to 1.23.1
  Bump @wordpress/block-editor from 5.2.0 to 5.2.1
westonruter added a commit that referenced this pull request Jan 22, 2021
…069-async-url-validation

* 'develop' of github.com:ampproject/amp-wp: (41 commits)
  Use wp_robots() instead of noindex() in WP 5.7 (#5793)
  Bump eslint-plugin-jsdoc from 31.0.3 to 31.0.4
  Bump google/cloud-storage from 1.23.0 to 1.23.1
  Update docs
  Bump stable tag to 2.0.10
  Add tests
  Restore intrinsic layout to amp-video in amp-story-page-attachment
  Use nonce scheme instead of auth scheme
  Utilize hash_equals() in unserialize_validation_error_messages()
  Fix jsdoc type as ReactElement
  Persist URL fragment through client-side mobile redirection
  Bump postcss from 8.2.2 to 8.2.4
  Bump eslint-plugin-jsdoc from 30.7.13 to 31.0.3
  Prevent infinite mobile redirect when non-AMP page served as AMP
  Remove the `class` attribute from `amp-fit-text` blocks to unblock block deprecation
  Update AMP validator spec to 8e02747, restoring intrinsic layout to amp-video
  Update validator spec to 1130
  Update amphtml spec to 2011252111002
  Bump @wordpress/compose from 3.23.0 to 3.23.1
  Bump @wordpress/block-editor from 5.2.0 to 5.2.1
  ...
@westonruter westonruter self-assigned this Mar 8, 2021
@westonruter
Copy link
Member Author

QA Passed.

WP 5.7-RC3

With search engine visibility disabled in WordPress 5.7-RC3:

image

Accessing an AMP page on a site with Reader mode and the Legacy theme active, I see the expected robots meta tag and no PHP notice is emitted:

<meta name="robots" content="noindex, nofollow">

When search engine visibility is enabled, this is replaced with:

<meta name="robots" content="max-image-preview:large">

WP 5.6.2

With search engine visibility disabled in WordPress 5.6.2, a Legacy AMP page shows:

<meta name="robots" content="noindex,nofollow">

And when search engine visibility is turned on, then no robots meta tag is added at all, as expected.

@westonruter westonruter added the Changelogged Whether the issue/PR has been added to release notes. label Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelogged Whether the issue/PR has been added to release notes. WS:Core Work stream for Plugin core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants