Hi all, I have created an ACF Block that uses a wp_query to display a filterable list of all posts of a specific post type. My issue is that I need to be able to add more than one of these blocks to a page, but when I do, I get a critical error. If I remove the wp_query, the page will load with multiple instances of the block. Anyone have any idea what I am doing wrong? My assumption is that I need to make the wp_query unique to the block instance, but I do not know how. Any help would be greatly appreciated.
The code is pretty large so I will just include my wp_query.
$args = array(
'post_type' => 'partners',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => $partner_type,
'operator' => 'IN',
),
),
);
if ($grid_hosts_weddings) {
$args['meta_query'][] = array(
'key' => 'hosts_weddings', // ACF field key for hosts_weddings
'value' => '1',
'compare' => '='
);
}
if ($grid_hosts_meetings) {
$args['meta_query'][] = array(
'key' => 'hosts_meetings', // ACF field key for hosts_meetings
'value' => '1',
'compare' => '='
);
}
$partners_query = new WP_Query($args);
I don’t know if I can help but the first thing is
What exactly is the error?
https://wordpress.org/documentation/article/debugging-in-wordpress/
What is the code that this causing the critical error?