Hi,
I’ve suddenly got ACF field groups showing up in Masonry element.
I’ve looked at this post – https://kriesi.at/support/topic/acf-field-group-post-type-in-blog-posts-elements/ – and tried the function suggested in there but that doesn’t cure the issue.
How can I stop this from happening?
Hey philthebass,
Thank you for the inquiry.
You may need to use the avia_masonry_entries_query filter instead of the previous one. Please try this code.
function avia_masonry_entries_query_mod($query, $params) {
foreach($query['post_type'] as $key => $value) {
if( $value == 'acf-field-group' ) {
unset($query['post_type'][$key]);
}
}
return $query;
}
add_filter('avia_masonry_entries_query', 'avia_masonry_entries_query_mod', 10, 2);
Best regards,
Ismael
Hi Ismael,
I tried that but it breaks the site if I add it to the child functions.php
“There has been a critical error on this website.”
Hi,
Thank you for the update.
Did you remove the previous filter? Please make sure that there are no duplicate function in the functions.php file. And try to copy the snippet directly from the forum, instead of your email.
Best regards,
Ismael
Thanks Ismael,
I copied it from the forum and that works nicely.
Thanks for your help.
Regards
Phil