Get Registered Custom Post Type to get All Custom Taxonomies

Try this (tested) code below. I believe the issue was the passing of the $post_type parameter to get_object_taxonomies (i.e. you passed it in quotes as ‘$post_type’. If uncomment the two var_dump‘s you’ll see what information is outputted. <?php $postargs = array( ‘public’ => true, ‘_builtin’ => false ); $post_types = get_post_types( $postargs, ‘names’, ‘and’ ); … Read more

Producing a list of media library items categorized under a certain taxonomy item

You can use a tax query for all “Reference Type” terms, which will retrieve all attachments that have at least one “Reference Type” term. $rt_media = new WP_Query( array( ‘posts_per_page’ => -1, ‘post_type’ => ‘attachment’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘reference_type’, ‘terms’ => get_terms( ‘reference_type’, array( ‘hide_empty’ => false, ‘fields’ => ‘ids’, ) ) … Read more

Query Number of Loaded Posts in Loop

The literal implementation would be to: Create array variable While looping add to it ID of each post, using term name as key (so you have array of arrays) After main loop check the array and query additional posts if needed, using stored IDs for post__not_in so there are no duplicates Syntax will be something … Read more