Title: $wpdb-&gt;options
Last modified: September 1, 2016

---

# $wpdb->options

 *  [Ashley](https://wordpress.org/support/users/nosegraze/)
 * (@nosegraze)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/wpdb-options/)
 * In `inc/backend-noajax.inc.php` you have this line near the bottom:
 * `$wpdb->query( "DELETE from $wpdb->options WHERE option_name LIKE '%bawmrp_{$
   post_ID}%'" );`
 * This actually doesn’t work as expected on my multisite installation. If I remember
   rightly (I found this error months ago), the problem was that when you save the
   related posts, you do it via `set_transient()`. That creates an entry in the 
   sub-site’s options table (i.e. `wp_2_options`), which is exactly what we want.
   But when you delete it, you use `$wpdb->options`, which doesn’t take multisite
   into consideration, so you actually delete from the generic `wp_options` table,
   rather than the individual sub-site table. This caused the transients to never
   get deleted.
 * I was able to fix the problem by replacing it with this instead:
 * `$wpdb->query( "DELETE from " . $wpdb->get_blog_prefix() . "options WHERE option_name
   LIKE '%bawmrp_{$post_ID}%'" );`
 * [get_blog_prefix()](https://developer.wordpress.org/reference/classes/wpdb/get_blog_prefix/)
   will get the database prefix, taking multisite into consideration. Then append“
   options” to it.
 * I’d appreciate it if you could adjust this so I don’t have to make the patch 
   on my own after every update. 🙂
 * [https://wordpress.org/plugins/baw-manual-related-posts/](https://wordpress.org/plugins/baw-manual-related-posts/)

The topic ‘$wpdb->options’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/baw-manual-related-posts_fefdfd.svg)
 * [Manual Related Posts](https://wordpress.org/plugins/baw-manual-related-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/baw-manual-related-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/baw-manual-related-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/baw-manual-related-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/baw-manual-related-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/baw-manual-related-posts/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Ashley](https://wordpress.org/support/users/nosegraze/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/wpdb-options/)
 * Status: not resolved