Viewing 1 replies (of 1 total)
  • Plugin Author webbistro

    (@webbistro)

    Hello @bsapaka,

    Lets assume your taxonomy name is ‘media_category’ and its term ID (category ID) is 5. Then you have to use code like:

    $ids = get_posts( array(
        'post_type' => 'attachment',
        'post_status' => 'any',
        'posts_per_page' => -1, // get all
        'tax_query' => array(
            array(
                'taxonomy' => 'media_category',
                'field' => 'id',
                'terms' => 5,
            ),
        ),
        'fields' => 'ids', // only get IDs
    ));

    -Nadia

Viewing 1 replies (of 1 total)
  • The topic ‘how to return all image ID's in a category’ is closed to new replies.