Title: Query Changes?
Last modified: August 18, 2016

---

# Query Changes?

 *  Resolved [yas](https://wordpress.org/support/users/yas/)
 * (@yas)
 * [20 years, 6 months ago](https://wordpress.org/support/topic/query-changes/)
 * Does anyone know if WordPress 2.0 changes the $wpdb class or the way that queries
   are sent? This query works for WP1.5 but returns ‘false’ under WP2:
 * $request = “SELECT post_id FROM $wpdb->postmeta LEFT OUTER JOIN $wpdb->posts 
   ON ID = post_id WHERE post_status = ‘publish’ AND meta_key = ‘featuretitle’ AND
   post_id != ‘$exclude’ ORDER BY rand() LIMIT $display”;
 * $posts = $wpdb->get_results($request);

Viewing 1 replies (of 1 total)

 *  Thread Starter [yas](https://wordpress.org/support/users/yas/)
 * (@yas)
 * [20 years, 6 months ago](https://wordpress.org/support/topic/query-changes/#post-291182)
 * Scratch that, found the problem.
 * The issue stems from the fact that my plugin requires $post_id to be set so it
   can write the correct info to the database. When you’re first creating a post,
   this value hasn’t been set and won’t be set until write_post() has been called.
   I guess my plugin is being called before that happens, so the wrong data is getting
   written (post_id defaulting to zero).
 * Any developers out there know how to approach this issue? Is there a way to get
   $post_id in the Write Post page if the post is brand new?

Viewing 1 replies (of 1 total)

The topic ‘Query Changes?’ is closed to new replies.

 * In: [Alpha/Beta/RC](https://wordpress.org/support/forum/alphabeta/)
 * 1 reply
 * 1 participant
 * Last reply from: [yas](https://wordpress.org/support/users/yas/)
 * Last activity: [20 years, 6 months ago](https://wordpress.org/support/topic/query-changes/#post-291182)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
