Preventing default query executions
-
I’m using $wpdb->get_results() to execute a couple of SQL Queries, I have a couple of option requests too and then I render out some HTML in to a page or as JSON.
I see that all go off nicely and a few other relevant theme and options but what I also see is whole bunch of post related “stuff” around the edges.
For HTML page I need to kill off everything that isn’t concerned with rendering the template and my SQL.
For JSON I want to kill off everything except my SQL.
Can anyone suggest how I do this please?
Examples of unnecessary commands ..
wp_get_archives()+
SELECT YEAR(post_date) ASyear
, MONTH(post_date) ASmonth
, count(ID) as posts
FROM wp_posts
WHERE post_type = ‘post’
AND post_status = ‘publish’
GROUP BY YEAR(post_date), MONTH(post_date)
ORDER BY post_date DESCget_terms()+
SELECT t.*, tt.*
FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt
ON t.term_id = tt.term_id
WHERE tt.taxonomy IN (‘category’)
AND tt.count > 0
ORDER BY t.name ASC
- The topic ‘Preventing default query executions’ is closed to new replies.