Return parent post with its children using WP_Query?
We can filter the posts_where clause of the generated SQL to also return the parent post/page and not just the parent’s children. Here we will set our own custom argument called wpse_include_parent, which, when set to true, will alter the generated SQL accordingly. All we need to do inside our posts_where filter is to check … Read more