Adrien Gardais
Adrien Gardais

Reputation: 11

Custom query with Elementor

I'm currently trying a custom query with Elementor, but it's not working.

I also tried a basic one (the example of the official website) and it's not working neither :

add_action( 'elementor/query/my_custom_filter', function( $query ) {
    $query->set( 'post_type', 'post' );
} );

Also, if I do var_dump($query), I have a query on another post.

Thanks for your help, Adrien.

Upvotes: 1

Views: 628

Answers (1)

Cristian B_F
Cristian B_F

Reputation: 35

In the elementor page, when you select the 'Source' query you cannot select the 'Current Query'. Just select any other option and the Query ID should be working. enter image description here

You can also try with add_filter instead of add_action.

Upvotes: 0

Related Questions