Public Ticket #2179099
Request for functionality Custom query filter


  • Siv Hansen started the conversation

    In Elementor Pro, the post widget has the option of setting a custom query filter


    Then I can add code in my functions.php to retrieve whatever posts/pages/taxonomies specified in my custom query. In my case, this is what I use:

    /** the elementor/query/ part of the add_action is always present. The next part is the name of my custom query filter, as provided in the Query ID (screen dump) and then the function where I set the query using native WP query.

    add_action( 'elementor/query/park_related_by_taxonomy', 'pixlweb_related_posts' );

    function pixlweb_related_posts( $query ) {

    $post = get_queried_object();

    $post_tags = get_the_tags($post->ID);

    $t = array();

    foreach($post_tags as $tags){

    $t[] = $tags->name;


    $params = array(

    'post_type' => 'parkexperience',

    'tax_query' => array(


    'taxonomy' => 'post_tag',

    'field' => 'slug',

    'terms' => $t,




    $query->set( 'tax_query', $params );


  •   Max replied privately