Target Post Type from array Query
$my_query->post_type refers to the post type of the query (in this case an array), and not the results. (Its recommended to use $my_query->get(‘post_type’) too, but anyway…). To get the current post’s (in the loop) post type: $post_type = get_post_type(); You can also use that function outside the loop by passing the post object / ID. … Read more