I would like to create a custom query ID (to use in Elementor) to get siblings pages of the current page + the parent page of the current page.

For now I get only siblings pages (without the parent page) with this code :

add_action( 'elementor_pro/posts/query/my_custom_filter2', function( $query ) {

$parent_page = wp_get_post_parent_id( get_the_ID() );

$query->set( 'post_parent', $parent_page );} );

I am sure it is not so difficult but I am a beginner and I can't find the solution...

Thank you very much for any help


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.