The template resolution system makes a request like `/?page_id=1234&_wp-find-template=true`, depending on `WP_Query` to resolve a page or post using the page_id or p (post_id) in the query string. With new posts/pages, a placeholder post with the status auto-draft is created. But by default `WP_Query` will not resolve these posts, unless the query is specifically set to look for them.
This commit handles the query string to properly resolve a page or post. It adds 2 private callbacks for the processing.
Props poena, noisysocks, bernhard-reiter, costdev, hellofromTonya.
Fixes#54553.
Built from https://develop.svn.wordpress.org/trunk@52316
git-svn-id: http://core.svn.wordpress.org/trunk@51908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This change fixes template resolution to give precedence to child theme PHP templates over parent theme block templates with equal specificity.
Before this change, when a theme was using a PHP template of a certain specificity (e.g. `page-home.php`), and it happened to be a child theme of another theme which had a block template for the same specificity (e.g. `page-home.html`), WordPress was picking the parent theme’s block template over the child theme’s PHP template to render the page. If the PHP and block template have equal specificity, the child theme's template should be used.
The issue was fixed before in Gutenberg so the fix now needs to happen in Core.
This change also re-enables the preexisting template resolution unit tests.
Follow-up to [51003].
Props bernhard-reiter, youknowriad.
Fixes#54515.
Built from https://develop.svn.wordpress.org/trunk@52308
git-svn-id: http://core.svn.wordpress.org/trunk@51900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
WordPress can be confident that WordPress functions exist.
I forgot this function existed.
And I thought that it would fatal, but it didn't
And it was so nice
So peaceful and quiet
I forgot this function existed
It isn't love, it isn't hate, it's just indifference
Introduced in [51003].
Props walbo.
Fixes#53578. See #53176.
Built from https://develop.svn.wordpress.org/trunk@51321
git-svn-id: http://core.svn.wordpress.org/trunk@50930 1a063a9b-81f0-0310-95a4-ce76da25c4cd