How do I go about building personalized query filter posts by present tag?

Hi every person, I would like to generate a custom query that filters posts by latest tag.

So I have bought 2 personalized publish kinds (therapists and companies) and on every single service web site I would like to present the therapists that deliver reported support. So I wanted to add matching tag to equally therapist and services and filter the posts by this tag. Because there are hundreds of services and therapists, I designed a template that applies to just about every support web page, that’s why acquiring posts with existing tag would be the very best option in my opinion.

For the moment I do have a customized question that filters posts by present category:

increase_motion( ‘elementor/query/km_experts_query’, operate( $query )

//get ID of latest submit

$id = get_queried_object_id()

// get latest taxonomy – in this circumstance the classification

$tax = get_the_phrases( $id, ‘category’)

&#x200B

$tax_question = array(

array(

‘taxonomy’ => ‘category’,

‘field’ => ‘slug’,

‘terms’ => $tax[0]->slug,

),

)

&#x200B

$query->set( ‘tax_query’, $tax_question )

&#x200B

)

Leave a Reply

Your email address will not be published. Required fields are marked *