How to display posts that are common in Category A and Tag A, and I want to display posts by shortcode so that the Shortcode can be used on multiple locations with different category Ids and Tags.
I found the below code by google but don't know how to implement it in functions.php and not sure how to use it in the shortcode. I want to display Post Title, And Some Custom Field Value [For Example - Value A, Value B] in a table structure.
$args = array(
'category__and' => 'category', //must use category id for this field
'tag__in' => 'post_tag', //must use tag id for this field
'posts_per_page' => -1); //get all posts
$posts = get_posts($args);
foreach ($posts as $post) :
//do stuff
endforeach;```