Skip to content

Instantly share code, notes, and snippets.

@sadrul
Last active August 29, 2015 14:00
Show Gist options
  • Save sadrul/11343594 to your computer and use it in GitHub Desktop.
Save sadrul/11343594 to your computer and use it in GitHub Desktop.
Wordpress search page query change
<?php
function advanced_search_query1($query) {
if ($query->is_search()) {
$query->set('post_type', array('product'));
return $query;
}
}
add_action('pre_get_posts', 'advanced_search_query1', 1000);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment