Title: PHP Warning error
Last modified: August 21, 2016

---

# PHP Warning error

 *  [syntheticmotoroilstoday.com](https://wordpress.org/support/users/syntheticmotoroilstodaycom/)
 * (@syntheticmotoroilstodaycom)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/php-warning-error-1/)
 * I receive the following php error when using the multisite global search on search
   results page:
 * Warning: Missing argument 2 for wpdb::prepare(), called in /home/synthorg/public_html/
   wp-content/plugins/multisite-global-search/inc/shortcodes.php on line 223 and
   defined in /home/synthorg/public_html/wp-includes/wp-db.php on line 992
 * [http://wordpress.org/plugins/multisite-global-search/](http://wordpress.org/plugins/multisite-global-search/)

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

 *  [yves.saintlary](https://wordpress.org/support/users/yvessaintlary/)
 * (@yvessaintlary)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/php-warning-error-1/#post-4199107)
 * Hello,
 * Same error for me.
    Below the php error tab is the actual search result. What’s
   wrong?
 * Thanks
 *  [yves.saintlary](https://wordpress.org/support/users/yvessaintlary/)
 * (@yvessaintlary)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/php-warning-error-1/#post-4199108)
 * The exact php error I read:
 * SCREAM: Error suppression ignored for
    Warning: Missing argument 2 for wpdb::
   prepare(), called in D:\wamp\www\selfshelfswap\wp-content\plugins\multisite-global-
   search\inc\shortcodes.php on line 223 and defined in D:\wamp\www\selfshelfswap\
   wp-includes\wp-db.php on line 992
 * Call Stack
    # Time Memory Function Location 1 0.0004 252832 {main}( ) ..\index.
   php:0 2 0.0008 256368 require( ‘D:\wamp\www\selfshelfswap\wp-blog-header.php’)..\
   index.php:17 3 1.2243 18997032 require_once( ‘D:\wamp\www\selfshelfswap\wp-includes\
   template-loader.php’ ) ..\wp-blog-header.php:16 4 1.2315 19469728 include( ‘D:\
   wamp\www\selfshelfswap\wp-content\themes\twentythirteen\page.php’ ) ..\template-
   loader.php:47 5 1.2511 19564944 the_content( ) ..\page.php:34 6 1.2511 19565544
   apply_filters( ) ..\post-template.php:166 7 1.2516 19567816 call_user_func_array()..\
   plugin.php:173 8 1.2516 19567848 do_shortcode( ) ..\plugin.php:173 9 1.2516 19568536
   preg_replace_callback ( ) ..\shortcodes.php:188 10 1.2516 19570288 do_shortcode_tag()..\
   shortcodes.php:188 11 1.2516 19570576 call_user_func ( ) ..\shortcodes.php:273
   12 1.2516 19570616 ms_global_search_page( ) ..\shortcodes.php:273 13 1.2517 19575008
   wpdb->prepare( ) ..\shortcodes.php:223
 *  [hilltop28](https://wordpress.org/support/users/hilltop28/)
 * (@hilltop28)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/php-warning-error-1/#post-4199173)
 * I’m also getting this exact same error.
 * I’m worried that it is a result of a WordPress upgrade (I’m using 3.7.1).
 * Does anyone know how to resolve this issue??
 *  [Aaron Haspel](https://wordpress.org/support/users/aaron-haspel/)
 * (@aaron-haspel)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/php-warning-error-1/#post-4199193)
 * I got the same error in 3.8. But it can be fixed. (Please note, I am just a programmer,
   not the author of the plugin, and no warranties are expressed or implied.)
 * The problem seems to be that WordPress, somewhere along the line, changed the
   function prepare() to take two arguments instead of only one.
 * Open the file shortcodes.php, located in the wp-content\plugins\multisite-global-
   search\inc directory, in a text editor.
 * Go to line 223. (If you don’t have a text editor with this functionality just
   search for “$request = $wpdb->prepare”.) Replace this:
 *     ```
       $request = $wpdb->prepare( "SELECT ".$wpdb->base_prefix."v_posts.* from ".$wpdb->base_prefix."v_posts left join ".$wpdb->users." on ".$wpdb->users.".ID=".$wpdb->base_prefix."v_posts.post_author ".
           			"where ".$wheresearch." ".$termsearch.
           		    "AND ( post_status = 'publish' OR post_status = 'private' ) AND ".$post_type." ORDER BY ".$wpdb->base_prefix."v_posts.blog_id ASC, ".$wpdb->base_prefix."v_posts.post_date DESC, ".$wpdb->base_prefix."v_posts.comment_count DESC" );
       ```
   
 * with this:
 *     ```
       $request = $wpdb->prepare( "SELECT ".$wpdb->base_prefix."v_posts.* from ".$wpdb->base_prefix."v_posts left join ".$wpdb->users." on ".$wpdb->users.".ID=".$wpdb->base_prefix."v_posts.post_author ".
           			"where ".$wheresearch." ".$termsearch.
           		    "AND ( post_status = 'publish' OR post_status = 'private' ) AND ".$post_type." ORDER BY ".$wpdb->base_prefix."v_posts.blog_id ASC, ".$wpdb->base_prefix."v_posts.post_date DESC, ".$wpdb->base_prefix."v_posts.comment_count DESC", "" );
       ```
   
 * Now go to line 225. Replace this:
 *     ```
       $request = $wpdb->prepare( "SELECT ".$wpdb->base_prefix."v_posts.* from ".$wpdb->base_prefix."v_posts left join ".$wpdb->users." on ".$wpdb->users.".ID=".$wpdb->base_prefix."v_posts.post_author ".
                       "where ".$wheresearch." ".$termsearch.
                       "AND post_status = 'publish' AND ".$post_type." ORDER BY ".$wpdb->base_prefix."v_posts.blog_id ASC, ".$wpdb->base_prefix."v_posts.post_date DESC, ".$wpdb->base_prefix."v_posts.comment_count DESC" );
       ```
   
 * with this:
 *     ```
       $request = $wpdb->prepare( "SELECT ".$wpdb->base_prefix."v_posts.* from ".$wpdb->base_prefix."v_posts left join ".$wpdb->users." on ".$wpdb->users.".ID=".$wpdb->base_prefix."v_posts.post_author ".
                       "where ".$wheresearch." ".$termsearch.
                       "AND post_status = 'publish' AND ".$post_type." ORDER BY ".$wpdb->base_prefix."v_posts.blog_id ASC, ".$wpdb->base_prefix."v_posts.post_date DESC, ".$wpdb->base_prefix."v_posts.comment_count DESC", "" );
       ```
   
 * This all looks worse than it is. You’re just adding a second empty argument to
   the wpdb->prepare call so it can be recognized.
 * If you do this correctly your error will go away.
 *  [johnzenausa](https://wordpress.org/support/users/johnzenausa/)
 * (@johnzenausa)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/php-warning-error-1/#post-4199194)
 * Thanks Aaron, it works perfectly now. Simple solution but something I would never
   have figured out.

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

The topic ‘PHP Warning error’ is closed to new replies.

 * ![](https://ps.w.org/multisite-global-search/assets/icon-256x256.png?rev=1594489)
 * [Multisite Global Search](https://wordpress.org/plugins/multisite-global-search/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/multisite-global-search/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/multisite-global-search/)
 * [Active Topics](https://wordpress.org/support/plugin/multisite-global-search/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/multisite-global-search/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/multisite-global-search/reviews/)

## Tags

 * [missing argument](https://wordpress.org/support/topic-tag/missing-argument/)
 * [php-error](https://wordpress.org/support/topic-tag/php-error/)

 * 5 replies
 * 5 participants
 * Last reply from: [johnzenausa](https://wordpress.org/support/users/johnzenausa/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/php-warning-error-1/#post-4199194)
 * Status: not resolved