• Resolved yinxingmaiming

    (@yinxingmaiming)


    Hi – new to WP Code. Trying to write a custom query and assign it to the Query ID in a post widget.

    I’ve tried many variations on the following, but nothing works. Probably not a WPCode issue, but I thought you folks might have some ideas:

    function custom_query_research_featured ( $query ) {
    // args
    $query_args = ();
    $query_args = array(
            'post_in'   => array( 14116 ),
            );
    
    // exec
    $query = new WP_Query( $query_args );
    }
    
    // ADD ACTION 
    add_action( 'elementor/query/{$query_id}', 'custom_query_research_featured' );

    Elementor post widget query ID = custom_query_research_featured

    Thx

Viewing 1 replies (of 1 total)
  • Thread Starter yinxingmaiming

    (@yinxingmaiming)

    Not a WPCode issue – the Elementor doc references: {$query_id}, which I assumed (incorrectly) meant a query id would be interpolated. It needs a literal: ‘elementor/query/xxxxxx’

Viewing 1 replies (of 1 total)
  • The topic ‘Elementor Custom Query’ is closed to new replies.