Based on the premise that one big database requests is better than many smaller ones, I’ve modified WP_Query for my custom post type ‘word’ and joined three tables to it. The resulting query looks more or less like this and works well.
I of course now have duplicate posts for each of the words’ respective definitions and I am rolling them back up into one post per word with an array of definitions instead.
But because these results are used in different ways all around the website, I’m having to write similar logic time and time again. Here, for example, I am using the data in an AJAX response.
What I would like to do now is extend the WP_Query class to have this done automatically on construction.
I don’t have any experience with OOP though so I am asking for some help/guidance. Is something like this possible?
Will I have to update a bunch of other properties to reflect the changes…? Like $post_count
What other things might I need to be aware of?