The current entity detection doesn't handle 404s in the same way that WordPress does, which can yield incorrect results. WordPress has WP::handle_404() to modify the main WP_Query instance flags accordingly after running it. We'll need to implement a method which takes care of that generically.
_Do not alter or remove anything below. The following sections will be managed by moderators only._
WP_Query::$is_404 is true), except for:page query parameter is greater than the number of available pages in the post).Synthetic_WP_Query utility class which extends WP core's WP_Query.WP_Query::get_posts():WP_Query::get_posts().WP::handle_404(), detecting a 404 based on query vars and found posts in the same way that WordPress does and calling WP_Query::set_404() as necessary.WP_Query::parse_query() to use a flag for whether the method has already been run for the given $query arguments, and if so, not run again.{siteURL}/wp-admin/admin.php?page=googlesitekit-dashboard&permaLink={url}, replacing url as explained below. For every URL, if indicated with "yes" below, ensure the white box at the top shows a corresponding title; if indicated with "no" below, ensure the white box at the top is empty (i.e. this is not considered a valid WordPress URL, i.e. if you visited it in the frontend you would get a 404):page/2/ (this would be the second page if the category would have more than 10 posts, which is not the case here) --> nopage/{index} (ensure index is a number greater than the number of posts that exist on your site divided by 10) -> noThe run_query method feels a bit out of place as a public method on the factory class. It seems like the intention is to lazy-load the execution of the query, which is understandable but it seems a bit off that we would need to go back to the factory to do that. Ideally, I think the factory would simply provide an object that works the way we want 🙂
What do you think about this instead?:
Synthetic_WP_Query class that extends WP_QuerySynthetic_WP_Query::get_posts would be extended with the logic of this method (calling parent::get_posts first), to preserve the desired on-demand nature ($query would become $this)WP_Query_Factory would be updated to return instances of Synthetic_WP_QueryEntity_Factory::from_url would still call $query->get_posts() rather than WP_Query_Factory::run_query which would no longer be necessary@aaemnnosttv Good idea! I've amended the IB. I've also added a point on overriding parse_query so that it doesn't unnecessarily run twice, which I think we can do as part of this issue.
IB ✅
Tested
Installed latest release candidate, activated SK and followed the above steps:


Comparing the above screenshots, scenario 'yes' and 'no'
Passed QA ✅