Display Custom Post By Custom Texonomy

PHOTO EMBED

Wed Jul 05 2023 08:22:54 GMT+0000 (Coordinated Universal Time)

Saved by @gshailesh27

<?php
$args = [
    "post_type" => "board_of_directors", // Replace 'your_post_type' with the actual name of your post type
    "posts_per_page" => -1, // Retrieve all posts
    "order" => "ASC",
    "tax_query" => [
        [
            "taxonomy" => "mambercategory",
            "field" => "slug",
            "terms" => "management-team",
        ],
    ],
];

$query = new WP_Query($args);

if ($query->have_posts()) {
    while ($query->have_posts()) {
        $query->the_post(); ?>
         
         <h3><?php the_title(); ?></h3>
                           
<?php } 
  wp_reset_postdata();
} else {
    // No posts found
}
?>
content_copyCOPY