Unable to get post content from custom post type loop

As other answers mentioned, you aren’t in The Loop so get_the_*() functions aren’t going to work properly. Since you’re looping over $query->get_posts() you can just use the WP_Post object. Something like this will work. foreach($query->get_posts() as $testimonial): $meta = get_post_meta($testimonial->ID); foreach($meta as &$m){ if(is_array($m)){ $m = $m[0]; } } <div class=”content”><?= do_shortcode($testimonial->post_content); ?></div> <div class=”author”>- … Read more