## php – Change the Category Name with ACF inside the loop

Question

I have the following loop:

<?php
$args = array( 'post_type' => 'cpt-a', 'category_name' => 'my-category', 'posts_per_page' => 99, 'orderby' => 'date', 'order' => 'ASC', 'ignore_sticky_posts' => 1, 'paged' =>$paged);
$loop = new WP_Query($args);
if ($loop->have_posts()) : while ($loop->have_posts()) : \$loop->the_post(); ?>

<div><?php echo get_the_content(); ?></div>
<span ><?php the_title(); ?></span>

<?php endwhile;
endif;
wp_reset_postdata();
?>


Is it possible to use a custom field (ACF) instead of “my-category”? I tried all the known options, but I could not find a working solution.

0
1 year 2021-11-25T20:23:45-05:00 0 Answers 0 views 0