Title: Preventing default query executions
Last modified: August 30, 2016

---

# Preventing default query executions

 *  [DanInManchester](https://wordpress.org/support/users/daninmanchester/)
 * (@daninmanchester)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/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) AS `year`, MONTH(post\_date) AS `
   month`, 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 DESC
 * get_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.

## Tags

 * [pages](https://wordpress.org/support/topic-tag/pages/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [query](https://wordpress.org/support/topic-tag/query/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * 0 replies
 * 1 participant
 * Last reply from: [DanInManchester](https://wordpress.org/support/users/daninmanchester/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/preventing-default-query-executions/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
