I want to create a post feed that displays the following:
- ALL posts in the CPT 'custom_post_type_1'
- Any 'post's in the category 'speakers'
So far, I have this filter which displays all posts in 'custom_post_type_1' and all posts in 'post".
add_action( 'elementor/query/my_custom_filter', function( $query ) {
$query->set( 'post_type', ['post', 'custom_post_type_1'] );
} );
I suspect I need to do a taxonomy array to accomplish my goal but am having difficulty writing one which filters only 'post' and which also shows all of 'custom_post_type_1' regardless of taxonomy.
I am fairly new to this and appreciate any assistance. (I am using Elementor, hence the mention of elementor in the query.)
pre_get_posts
. You could leave the filter as is, and then in your template, filter the posts further inside the loop.if (get_post_type() === 'post' && !has_term('', 'speakers')) continue