How to extract the tags shared between two different post types in Wordpress

/ Published in: PHP
Save to your folder(s)

Extract all the tags (shared between two post types) used with a specific post type

Copy this code and paste it in your HTML
  1. $articles_in_post_type = get_posts( array(
  2. 'fields' => 'ids',
  3. 'post_type' => 'post',
  4. 'posts_per_page' => -1,
  5. ));
  6. $tags = wp_get_object_terms( $articles_in_post_type, 'post_tag', array('ids') );


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.