In this code snippet we will share how to get all posts associated with a custom taxonomy in WordPress. If you want to get all posts associated with custom taxonomy, You need to use some line of code to get all posts associated with a custom taxonomy.

Use the following code to get all posts associated with a custom taxonomy:

<?php
//Get all posts associated with 'mycustomtax' taxonomy
$args = array(
    'post_type' => 'post',
    'tax_query' => array(
        array(
            'taxonomy' => 'mycustomtax',
            'operator' => 'EXISTS'
        ),
    ),
);
$query = new WP_Query( $args );
?>

If you feel this snippet useful? Any questions or suggestions? Do let me know your thoughts via comments.

How to Get Post Content By Post ID in WordPress Click To Tweet Don't forget to subscribe via email so you never miss a post! You can also follow us on Facebook and Twitter!
Get All Posts Associated With Custom Taxonomy in WordPress
5 (100%) 3 votes

(Visited 27 times, 1 visits today)

About the Author: Editorial Staff

Editorial Staff at the WPChandra is a team of WordPress experts writing about WordPress Tutorials, Themes, Plugins, Guides, Tricks and much more...

Leave a Reply

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