Skip to content

Instantly share code, notes, and snippets.

@hluaces
Last active September 23, 2019 07:19
Show Gist options
  • Save hluaces/db03d92ec758415c167ce585fd5805cf to your computer and use it in GitHub Desktop.
Save hluaces/db03d92ec758415c167ce585fd5805cf to your computer and use it in GitHub Desktop.
Filtro que añade a las búsquedas de WordPress tanto entradas como páginas
function filtro_mostrar_entradas_y_posts($query) {
if ($query->is_search) {
$query->set('post_type', ['post', 'page']);
}
return $query;
}
add_filter('pre_get_posts','filtro_mostrar_entradas_y_posts');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment