I'm getting back into WordPress development again, but noticed a lot of things have changed but want to take advantage of any new efficient methods that exist in the Gutenberg system.
I want to create a custom search that only queries custom post types. When I switch to the code editor mode, I noticed I might be able to add more settings. This is what I see:
<div class="wp-block-group">
<!-- wp:search {"label":"Search","showLabel":false,"buttonText":"Search","buttonPosition":"button-inside","buttonUseIcon":true} /-->
</div>
Are there any settings I can add to this wp:search line that would let me isolate querying a custom post type only?
I'm getting back into WordPress development again, but noticed a lot of things have changed but want to take advantage of any new efficient methods that exist in the Gutenberg system.
I want to create a custom search that only queries custom post types. When I switch to the code editor mode, I noticed I might be able to add more settings. This is what I see:
<div class="wp-block-group">
<!-- wp:search {"label":"Search","showLabel":false,"buttonText":"Search","buttonPosition":"button-inside","buttonUseIcon":true} /-->
</div>
Are there any settings I can add to this wp:search line that would let me isolate querying a custom post type only?
You can try adjusting the post type of the search query with:
<!-- wp:search {
"label":"Search",
"buttonText":"Search",
"query" : {"post_type" : "cpt"}
} /-->
replacing cpt
with your custom post type.
This will add a hidden input tag, to the search form, for the post_type
GET query parameter.