Is there a way of increasing the speed of this query?

We can do quite a lot to improve performance of your code. Lets set some benchmarks first BENCH MARKS I’m testing this with a category taxonomy term which has 9 posts and the post_tag taxonomy with 61 matching tags. With your current code, I get the following results 69 queries in =/- 0.4s That is … Read more

Differences between wpdb->get_results() and wpdb->query()

The difference, if you want to call it that, is that the query() is the most generalized method to do queries with $wpdb, the get_results() method on the other hand is a specific method, which does make use of the query() method to retrieve the specific results of this method and then does some work … Read more

Remove the Homepage Query

The posts_request filter Skimming through the WP_Query we find this part of interest: if ( !$q[‘suppress_filters’] ) { /** * Filter the completed SQL query before sending. * * @since 2.0.0 * * @param array $request The complete SQL query. * @param WP_Query &$this The WP_Query instance (passed by reference). */ $this->request = apply_filters_ref_array( ‘posts_request’, … Read more

WP_Query vs get_posts

The difference between get_posts & WP_Query You can view get_posts() as a slimmed down WP_Query. In fact looking at the source: //… prepares query array $r $get_posts = new WP_Query; return $get_posts->query($r); get_posts() use WP_Query, but only returns an array of posts – nothing more. Furthermore it sets: $r[‘no_found_rows’] = true; Normally (by default with … Read more

Proper way to get page content

Just to clarify: You mixed two things here. qTranslate stores the different languages in the same post. If you call get_content(), $post->content or an other direct query, you will get the whole content with all different languages from the database. What qTranslates do, it creates a filter-hook which is attached to the_content hook. If somebody … Read more