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

#40675: Ensure only the main query is modified when resolving template for new posts. #40799

Merged
merged 1 commit into from
Jun 23, 2022

Conversation

petitphp
Copy link
Contributor

@petitphp petitphp commented May 3, 2022

What?

Fix 404 response when resolving template for new posts/pages (#40675).

This issue has been reported with WordPress 6.0 beta 3 and can still be reproduced in RC1.

Since the bug only occur with the Gutenberg plugin disable, this PR would need to be backported into WordPress core to fix the original issue.

@github-actions
Copy link

github-actions bot commented May 3, 2022

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @petitphp! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label May 3, 2022
@skorasaurus skorasaurus added [Feature] Templates API Related to API powering block template functionality in the Site Editor REST API Interaction Related to REST API labels May 5, 2022
@carolinan
Copy link
Contributor

To test, I added the suggested if statement to wp-includes/block-template.php, _resolve_template_for_new_post() line 315.
That solved the issue.

@ndiego
Copy link
Member

ndiego commented May 16, 2022

I completely overlooked this 😅, but I just tested following @carolinan's notes, and this fix works as expected.

@gziolo @adamziel thoughts on this for 6.0? It's more of a "visual" bug than a critical one in my opinion. The page/post still displays correctly on the frontend. Perhaps we bump to 6.0.1?

@gziolo
Copy link
Member

gziolo commented May 16, 2022

@ndiego, based on the changes applied I assume that the bug existed from WordPress 5.9 so I would vote for including this fix in WP 6.0.1.

@adamziel
Copy link
Contributor

adamziel commented May 16, 2022

I echo @gziolo, let's ship the fix with WP 6.0.1

@ndiego
Copy link
Member

ndiego commented May 16, 2022

Perfect, I have moved to the 6.0.1 Project Board.

@TimothyBJacobs TimothyBJacobs removed the REST API Interaction Related to REST API label May 27, 2022
@adamziel adamziel added Backport to WP Minor Release Pull request that needs to be backported to a WordPress minor release Needs PHP backport Needs PHP backport to Core labels Jun 23, 2022
@adamziel adamziel merged commit 8587759 into WordPress:trunk Jun 23, 2022
@github-actions
Copy link

Congratulations on your first merged pull request, @petitphp! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 13.6 milestone Jun 23, 2022
@adamziel
Copy link
Contributor

@petitphp thank you for your PR! Would you be willing to prepare a backport PR for the https://github.com/WordPress/wordpress-develop repo (6.0 branch)?

@petitphp petitphp deleted the fix/40675 branch June 24, 2022 07:11
@petitphp
Copy link
Contributor Author

@adamziel Yes I can do that. Is there an existing trac ticket I should mention for the backport or should I create one (asking because I just saw this one https://core.trac.wordpress.org/ticket/56058).

Also since this issue is present in the 5.9 should it been backport to this branch too ?

@petitphp
Copy link
Contributor Author

@adamziel backport PR created WordPress/wordpress-develop#2888

@adamziel
Copy link
Contributor

Thank you so much @petitphp, good call thinking about a ticket.

Also since this issue is present in the 5.9 should it been backport to this branch too ?

Good question 🤔 The way I've seen this handled on the security side of things was to commit to the latest branch first and then one person would backport to all the previous applicable branches. Let's ask directly in that PR!

@adamziel
Copy link
Contributor

I just cherry-picked this PR to the wp/6.0 branch to get it included in the next release: a34e00b

adamziel pushed a commit that referenced this pull request Jun 30, 2022
@adamziel adamziel removed the Backport to WP Minor Release Pull request that needs to be backported to a WordPress minor release label Jun 30, 2022
pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Jun 30, 2022
…e for new posts.

This adds a check for the main query in `_resolve_template_for_new_post()` to fix a 404 response when resolving template for new posts or pages caused by the wrong query being modified.

Original PR from Gutenberg repository:
* [WordPress/gutenberg#40799 #40799: Ensure only the main query is modified when resolving template for new posts]

Follow-up to [52316].

Props petitphp, zieladam, poena, ndiego, gziolo, kebbet, Mamaduka, manfcarlo.
Merges [53593] to the 6.0 branch.
See #56058.

git-svn-id: https://develop.svn.wordpress.org/branches/6.0@53594 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Jun 30, 2022
…e for new posts.

This adds a check for the main query in `_resolve_template_for_new_post()` to fix a 404 response when resolving template for new posts or pages caused by the wrong query being modified.

Original PR from Gutenberg repository:
* [WordPress/gutenberg#40799 #40799: Ensure only the main query is modified when resolving template for new posts]

Follow-up to [52316].

Props petitphp, zieladam, poena, ndiego, gziolo, kebbet, Mamaduka, manfcarlo.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53593


git-svn-id: https://core.svn.wordpress.org/trunk@53181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
gMagicScott pushed a commit to gMagicScott/core.wordpress-mirror that referenced this pull request Jun 30, 2022
…e for new posts.

This adds a check for the main query in `_resolve_template_for_new_post()` to fix a 404 response when resolving template for new posts or pages caused by the wrong query being modified.

Original PR from Gutenberg repository:
* [WordPress/gutenberg#40799 #40799: Ensure only the main query is modified when resolving template for new posts]

Follow-up to [52316].

Props petitphp, zieladam, poena, ndiego, gziolo, kebbet, Mamaduka, manfcarlo.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53593


git-svn-id: https://core.svn.wordpress.org/trunk@53181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Jun 30, 2022
…e for new posts.

This adds a check for the main query in `_resolve_template_for_new_post()` to fix a 404 response when resolving template for new posts or pages caused by the wrong query being modified.

Original PR from Gutenberg repository:
* [WordPress/gutenberg#40799 #40799: Ensure only the main query is modified when resolving template for new posts]

Follow-up to [52316].

Props petitphp, zieladam, poena, ndiego, gziolo, kebbet, Mamaduka, manfcarlo.
Merges [53593] to the 6.0 branch.
See #56058.
Built from https://develop.svn.wordpress.org/branches/6.0@53594


git-svn-id: https://core.svn.wordpress.org/branches/6.0@53182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
gMagicScott pushed a commit to gMagicScott/core.wordpress-mirror that referenced this pull request Jun 30, 2022
…e for new posts.

This adds a check for the main query in `_resolve_template_for_new_post()` to fix a 404 response when resolving template for new posts or pages caused by the wrong query being modified.

Original PR from Gutenberg repository:
* [WordPress/gutenberg#40799 #40799: Ensure only the main query is modified when resolving template for new posts]

Follow-up to [52316].

Props petitphp, zieladam, poena, ndiego, gziolo, kebbet, Mamaduka, manfcarlo.
Merges [53593] to the 6.0 branch.
See #56058.
Built from https://develop.svn.wordpress.org/branches/6.0@53594


git-svn-id: https://core.svn.wordpress.org/branches/6.0@53182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@adamziel adamziel removed the Needs PHP backport Needs PHP backport to Core label Jul 5, 2022
whereiscodedude pushed a commit to whereiscodedude/wpss that referenced this pull request Sep 18, 2022
…e for new posts.

This adds a check for the main query in `_resolve_template_for_new_post()` to fix a 404 response when resolving template for new posts or pages caused by the wrong query being modified.

Original PR from Gutenberg repository:
* [WordPress/gutenberg#40799 #40799: Ensure only the main query is modified when resolving template for new posts]

Follow-up to [52316].

Props petitphp, zieladam, poena, ndiego, gziolo, kebbet, Mamaduka, manfcarlo.
Merges [53593] to the 6.0 branch.
See #56058.
Built from https://develop.svn.wordpress.org/branches/6.0@53594
whereiscodedude pushed a commit to whereiscodedude/wpss that referenced this pull request Sep 18, 2022
…e for new posts.

This adds a check for the main query in `_resolve_template_for_new_post()` to fix a 404 response when resolving template for new posts or pages caused by the wrong query being modified.

Original PR from Gutenberg repository:
* [WordPress/gutenberg#40799 #40799: Ensure only the main query is modified when resolving template for new posts]

Follow-up to [52316].

Props petitphp, zieladam, poena, ndiego, gziolo, kebbet, Mamaduka, manfcarlo.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53593
VenusPR added a commit to VenusPR/Wordpress_Richard that referenced this pull request Mar 9, 2023
…e for new posts.

This adds a check for the main query in `_resolve_template_for_new_post()` to fix a 404 response when resolving template for new posts or pages caused by the wrong query being modified.

Original PR from Gutenberg repository:
* [WordPress/gutenberg#40799 #40799: Ensure only the main query is modified when resolving template for new posts]

Follow-up to [52316].

Props petitphp, zieladam, poena, ndiego, gziolo, kebbet, Mamaduka, manfcarlo.
Merges [53593] to the 6.0 branch.
See #56058.
Built from https://develop.svn.wordpress.org/branches/6.0@53594


git-svn-id: https://core.svn.wordpress.org/branches/6.0@53182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Templates API Related to API powering block template functionality in the Site Editor First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants