Skip to content

Instantly share code, notes, and snippets.

@williamdodson
Last active August 29, 2015 14:02
Show Gist options
  • Save williamdodson/277f830a57c6215a127c to your computer and use it in GitHub Desktop.
Save williamdodson/277f830a57c6215a127c to your computer and use it in GitHub Desktop.
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