Skip to content

Function

Parse the query.

tml_parse_query( $wp_query )

Parameters

$wp_query
WP_Query The query object.

Source

function tml_parse_query( $wp_query ) {

    // Bail if not in the main loop
    if ( ! $wp_query->is_main_query() ) {
        return;
    }

    // Bail if not home
    if ( ! $wp_query->is_home || $wp_query->is_posts_page ) {
        return;
    }

    // Bail if not handling a TML action
    if ( ! tml_is_action() ) {
        return;
    }

    // Tell WordPress that this is a page
    $wp_query->is_tml_action = true;
    $wp_query->is_page       = true;
    $wp_query->is_singular   = true;
    $wp_query->is_single     = false;
    $wp_query->is_home       = false;

    // No need to calculate found rows
    $wp_query->set( 'no_found_rows', true );

    // Matter of fact, no need to query anything
    $wp_query->set( 'post__in', array( 0 ) );
}

Uses

Changelog

VersionDescription
7.0 Introduced.