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

Protect: introduce new wp_robots_no_robots when available #18897

Merged
merged 2 commits into from
Feb 23, 2021

Conversation

jeherve
Copy link
Member

@jeherve jeherve commented Feb 22, 2021

Changes proposed in this Pull Request:

wp_robots_no_robots() replaces wp_no_robots() in WP 5.7:
https://core.trac.wordpress.org/ticket/51511#comment:13

Jetpack product discussion

Primary issue: #18842

Does this pull request change what data or activity we track or use?

  • No

Testing instructions:

  • Add the following constant to your site: define( 'JETPACK_ALWAYS_PROTECT_LOGIN', true );
  • Connect your site to WordPress.com; Protect should be automatically enabled.
  • Log out
  • Try to log back in.
  • See the new blocked login page.
  • Whether you use WordPress 5.6 or WP 5.7 (via the WordPress Beta Tester plugin for example), you should see a <meta name='robots' content meta tag in the page's head.

Proposed changelog entry for your changes:

  • Protect: use new Robots API introduced in WordPress 5.7 when displaying a blocked login page.

@jeherve jeherve added [Feature] Protect Also known as Brute Force Attack Protection [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Type] Janitorial [Pri] Normal labels Feb 22, 2021
@jeherve jeherve self-assigned this Feb 22, 2021
@github-actions github-actions bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label Feb 22, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Feb 22, 2021

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Include a changelog entry for any meaningful change.
  • ✅ Specify whether this PR includes any changes to data or privacy.

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


If you are an automattician, once your PR is ready for review add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.undefined


jetpack plugin:

  • Next scheduled release: March 2, 2021.
  • Scheduled code freeze: February 22, 2021

@Automattic Automattic deleted a comment from github-actions bot Feb 22, 2021
@jeherve jeherve added this to the 9.5 milestone Feb 22, 2021
@jeherve jeherve added [Status] In Progress and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Feb 22, 2021
@jeherve jeherve added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] In Progress labels Feb 22, 2021
bisko
bisko previously approved these changes Feb 22, 2021
anomiex
anomiex previously approved these changes Feb 22, 2021
Copy link
Contributor

@anomiex anomiex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok, other than that with WP 5.7-beta3-50398 it complains about is_embed and is_search being called incorrectly.

Notice: is_embed was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /srv/users/user75dff923/apps/user75dff923/public/wp-includes/functions.php on line 5313

Notice: is_search was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /srv/users/user75dff923/apps/user75dff923/public/wp-includes/functions.php on line 5313

@anomiex anomiex added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Feb 22, 2021
@jeherve
Copy link
Member Author

jeherve commented Feb 22, 2021

it complains about is_embed and is_search being called incorrectly.

Ah yes, seeing it too now. That's problematic, we're getting rid of one notice for 2 others, because we're trying to use wp_robots() too early on, on a page where nothing else has happened yet. wp_no_robots() didn't have those limitations since there was nothing hooked to it.

I'd be tempted to hardcode the meta tag in this case. I don't think we need the flexibility and filterability in this specific case.

What do you think? I just pushed 024b5f5 as an option.

@jeherve jeherve dismissed stale reviews from anomiex and bisko via 024b5f5 February 22, 2021 17:39
@jeherve jeherve added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Feb 22, 2021
Copy link
Contributor

@leogermani leogermani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I agree it's fine and much simpler to hardcode the meta tags here.

@leogermani leogermani added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Feb 22, 2021
@jeherve jeherve merged commit 41e3bf9 into master Feb 23, 2021
@jeherve jeherve deleted the update/robots-api branch February 23, 2021 07:47
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Feb 23, 2021
jeherve added a commit that referenced this pull request Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Protect Also known as Brute Force Attack Protection [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal [Type] Janitorial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants