wp remove query

I’m assuming you’re talking about this piece of maintenance code right here:

http://core.trac.wordpress.org/browser/tags/3.3.1/wp-admin/includes/post.php#L419

Indeed, the code calls on lower level functionality of $wpdb, which doesn’t contain too many hooks, only one in fact, query.

http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/wp-db.php#L1061

So, in order to return an empty result set you’ll have to come up with a no-operation type of query, here are some examples:

  • SELECT NULL; (returns 1 NULL result)
  • DO 0;
  • SET @ignore_me = 0;
  • SELECT * FROM `$wpdb->posts` WHERE 1=0;

Leave a Comment