Multiple Custom Post Type in Taxonomy Archive Causing White Screen

So basically I’m trying to add multiple custom post type in my taxonomy archive. Here’s my code:

<?php
$args_trip = array (
‘post_type’ => ‘trip’ ,
‘post_status’ => ‘publish’,
‘tax_query’ => array (
array (
‘taxonomy’ => ‘destination’,
‘field’ => ‘slug’,
‘terms’ => $term
)
)
);

$trips = new WP_Query( $args_trip );
?>

<?php
if ( $trips->have_posts() ) : ?>
<div class=”archive-grid”>
<?php
/* Start the Loop */
while ( $trips->have_posts() ) : $trips->the_post();
get_template_part( ‘template-parts/content’, ‘trip’ );

endwhile;
wp_reset_postdata();
?>
</div>
<hr>

<?php
$args_wisata = array (
‘post_type’ => ‘wisata’ ,
‘post_status’ => ‘publish’,
‘tax_query’ => array (
array (
‘taxonomy’ => ‘destination’,
‘field’ => ‘slug’,
‘terms’ => $term
)
)
);

$wisatas = new WP_Query( $args_wisata );

if ( $wisatas->have_posts() ) :
?>

<div class=”archive-grid”>

<?php
/* Start the Loop */
while ( $wisatas->have_posts() ) : $wisatas->the_post();
get_template_part( ‘template-parts/content’, ‘wisata’ );

endwhile;

?>

</div>

The code above meant to output TWO different custom post type TRIP & WISATA within taxonomy archive.

BUT it always causing white screen, but when it only looping ONE custom post type, it works fine. Here’s the code for only one custom post type:

<?php
$args_trip = array (
‘post_type’ => ‘trip’ ,
‘post_status’ => ‘publish’,
‘tax_query’ => array (
array (
‘taxonomy’ => ‘destination’,
‘field’ => ‘slug’,
‘terms’ => $term
)
)
);

$trips = new WP_Query( $args_trip );
?>

<?php
if ( $trips->have_posts() ) : ?>
<div class=”archive-grid”>
<?php
/* Start the Loop */
while ( $trips->have_posts() ) : $trips->the_post();
get_template_part( ‘template-parts/content’, ‘trip’ );

endwhile;
wp_reset_postdata();

?>
</div>
<hr>

I don’t know what might be causing this? Really frustrate me… Please someone help me! Lol.

NOTE: my wp-config.php already has define(‘WP_DEBUG’, true); but there is no error shown, only blank white page.

Read more here:: Multiple Custom Post Type in Taxonomy Archive Causing White Screen

Leave a Reply

Your email address will not be published. Required fields are marked *