Support

Account

Home Forums General Issues Relationship Field Query For Parent

Unread

Relationship Field Query For Parent

  • I’m using Elementor for a site and using ACF to build out the backend. I’m trying to do a custom query for some pages. I currently have this working great to include Posts that have a relationship with the Currrent Post:

    // Showing post with meta key filter in Coaches Widget
    add_action( 'elementor/query/program_filter', function( $query ) {
    	// Get current meta Query
    	$meta_query = $query->get( 'meta_query' );
    	// Append our meta query
    	$meta_query = [ [
    
    		'key' => 'programs', // name of custom field
    		'value' => '"' . get_the_ID() . '"', 
    		'compare' => 'LIKE',
    	] ];
    	$query->set( 'meta_query', $meta_query );
    } );

    Is there a way to make this query include the parent of the post?

Viewing 1 post (of 1 total)

The topic ‘Relationship Field Query For Parent’ is closed to new replies.