Making WordPress.org

Changeset 2679


Ignore:
Timestamp:
03/03/2016 07:03:43 PM (10 years ago)
Author:
Otto42
Message:

Allow main post query to run so that the correctly populates, allowing things like oembed to work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php

    r2540 r2679  
    127127}
    128128add_filter( 'body_class', 'wporg_themes_body_class' );
    129 
    130 /**
    131  * Prevent the default posts queries running, allowing pages to bypass
    132  * We do this as the themes are pulled from an API.
    133  */
    134 function wporg_themes_prevent_posts_query( $query, $wp_query ) {
    135     if ( is_admin() || ! $wp_query->is_main_query() || $wp_query->get( 'pagename' ) ) {
    136         return $query;
    137     }
    138     $wp_query->set( 'no_found_rows', true );
    139     return ''; // Don't make a query
    140 }
    141 add_filter( 'posts_request', 'wporg_themes_prevent_posts_query', 10, 2 );
    142129
    143130/**
Note: See TracChangeset for help on using the changeset viewer.