Title: Doesn&#039;t work with database prefixes
Last modified: August 20, 2016

---

# Doesn't work with database prefixes

 *  Resolved [Dana Ross](https://wordpress.org/support/users/csixty4/)
 * (@csixty4)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/doesnt-work-with-database-prefixes/)
 * I specified a custom database prefix when setting up my site, and My Post Order
   was giving an error when displaying posts. I had to patch it to support custom
   database prefixes.
 * In functions.php, mpo_change_condition()…
 * Add $wpdb to the list of global variables:
 *  global $wp_query, $post_ids, $wpdb;
 * Use the database prefix when building a query:
 *  $where .= ‘AND ‘ . $wpdb->prefix . ‘posts.ID IN (‘ . $post_ids . ‘)’;
 * [http://wordpress.org/extend/plugins/my-posts-order/](http://wordpress.org/extend/plugins/my-posts-order/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * (@kapilchugh)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/doesnt-work-with-database-prefixes/#post-3312112)
 * Thank you. Will check it.
 *  Plugin Author [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * (@kapilchugh)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/doesnt-work-with-database-prefixes/#post-3312133)
 * Bug has been resolved in new version.
 * Thanks again!!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Doesn't work with database prefixes’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/my-posts-order_8e9dad.svg)
 * [My Post Order](https://wordpress.org/plugins/my-posts-order/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/my-posts-order/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/my-posts-order/)
 * [Active Topics](https://wordpress.org/support/plugin/my-posts-order/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/my-posts-order/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/my-posts-order/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/doesnt-work-with-database-prefixes/#post-3312133)
 * Status: resolved