Skip to content

Instantly share code, notes, and snippets.

@SiR-DanieL
Created August 20, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SiR-DanieL/46d8f085258606f4bf27 to your computer and use it in GitHub Desktop.
Save SiR-DanieL/46d8f085258606f4bf27 to your computer and use it in GitHub Desktop.
function temporary_fix_product_search( $where ) {
global $pagenow, $wpdb, $wp;
if ( 'edit.php' != $pagenow || ! is_search() || ! isset( $wp->query_vars['s'] ) || 'product' != $wp->query_vars['post_type'] ) {
return $where;
}
$where = str_replace( "post_type = ' '", "post_type = 'product'", $where );
return $where;
}
add_filter( 'posts_search', 'temporary_fix_product_search', 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment