Last active
June 15, 2019 06:54
-
-
Save joebasurto/c8959c7aa355fb029193913ba93e2647 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Searchable Ecwid products add to functions.php | |
*/ | |
// Pre post hook, query modifier | |
add_filter('pre_get_posts', 'tgm_io_cpt_search'); | |
// Modifier function | |
function tgm_io_cpt_search($query) { | |
if ($query->is_search) { | |
// Add ec-product post type; will also except other custom post types | |
$query->set('post_type', array('ec-product')); | |
} | |
// Return result | |
return $query; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment