Aaron
Junho 29, 2024, 6:36pm
1
I added the following functions to my child theme’s functions.php which I thought should allow them to be indexed in there and show up in search:
add_filter( 'jetpack_search_post_types', function( $post_types ) {
$post_types[] = 'tnc_col_50901_item';
$post_types[] = 'tnc_col_55294_item';
return $post_types;
} );
add_filter(
'jetpack_search_allowed_taxonomies_for_widget_filters',
function( $taxonomies ) {
$taxonomies[] = 'tnc_tax_51091';
$taxonomies[] = 'tnc_tax_53440';
return $taxonomies;
}
);
Hi @Aaron !
I’ve been trying to debug this… never used Jetpack Search before but it should work. I’ve used the same code that you provided and I was able to enable the taxonomies. The post type, however is not working. But doing a quick search in their docs, I couldn’t find this jetcpack_search_post_types
filter. Are you sure this is the correct name of this hook?
Aaron
Julho 5, 2024, 11:40pm
3
I am not sure that is the correct filter. I found it on some blog post some time ago and can’t find the reference any more.
Have you tried adding the CPTs via WordPress pre_get_posts
? It seems to be their recommended strategy:
Let’s say you run a blog covering various topics like technology, travel, and food. With Inline Search, you have the power to tailor how your search function operates and appears to your visi…
system
Fechado
Setembro 6, 2024, 1:09pm
5
Este tópico foi fechado automaticamente 60 dias depois da última resposta. Novas respostas não são mais permitidas.