Hi,
How can i hide custom post types in my overview of blogposts? In this case we have a CPT “vacature” which is visible in the overview at this page: (see URL). I have a piece of code to hide this in the masonry element but in this case we use the “blogposts” element to show the blogposts.
Hey bonsaimedia,
Thank you for the inquiry.
You can use the following filter in the functions.php file to exclude a specific custom post type from the query.
function avia_post_slide_query_mod($query, $params) {
foreach($query['post_type'] as $key => $value) {
if( $value == 'vacature' ) {
unset($query['post_type'][$key]);
}
}
return $query;
}
add_filter('avia_post_slide_query', 'avia_post_slide_query_mod', 10, 2);
Best regards,
Ismael
Hi Ismael,
Thanks for your help! I tried it but it’s not working. Can you check again please? See also a link to screenvideo which element we use to be sure.
Many thanks!
Hi,
Have you tried replacing “vacature” with “acf-field-group”?
if( $value == 'acf-field-group' ) {
Best regards,
Ismael
Hi Ismael,
Yes, that works. Many thanks!