Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

HappyFiles

// WP_Query arguments
$args = array(
	'post_type'              => array( 'attachment' ),
	'post_status'            => array( 'inherit' ),
	'tax_query'              => array(
		'relation' => 'AND',
		array(
			'taxonomy'         => 'happyfiles_category',
			'terms'            => 'portfolio',
			'field'            => 'term_id',
		),
	),
);

// The Query
$query = new WP_Query( $args );