Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WP Search Exclude Change
<?php
/* ORIGINAL: search-exclude.php Line 119 */
public function searchFilter($query)
{
if ($query->is_search) {
$query->set('post__not_in', array_merge($query->get('post__not_in'), $this->getExcluded()));
}
return $query;
}
/* CHANGES: search-exclude.php Line 120 */
/* modified this function to ignore admin dashboard --wdodson 2014-05-08 */
public function searchFilter($query)
{
if(!is_admin()) {
if ($query->is_search) {
$query->set('post__not_in', array_merge($query->get('post__not_in'), $this->getExcluded()));
}
return $query;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment