Hello, the piece of code you see in my previous post (linked above) is creating a glitch on the layouts menu: it doesn’t display nothing. I need to use this code, can you help me to understand if there is something wrong in it?
function searchfilter($query) {
if ($query->is_search && !is_admin() ) {
$query->set('post_type',array('product'));
}
return $query;
}
add_filter('pre_get_posts','searchfilter');