Get All Posts Associated With Custom Taxonomy in WordPress
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 ); ?>
Other Useful Snippets:
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!