Advertisement
Gaskabur

Get POST by taxonomy

Sep 16th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.28 KB | None | 0 0
  1. $pages = get_posts(array(
  2.   'post_type' => 'page',
  3.   'numberposts' => -1,
  4.   'tax_query' => array(
  5.     array(
  6.       'taxonomy' => 'taxonomy-name',
  7.       'field' => 'id',
  8.       'terms' => 1, // Where term_id of Term 1 is "1".
  9.       'include_children' => false
  10.     )
  11.   )
  12. ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement