Make WordPress Core

Changeset 26951


Ignore:
Timestamp:
01/15/2014 08:16:26 AM (13 years ago)
Author:
nacin
Message:

Avoid a fatal error in wp_reset_postdata() if $wp_query global is not set.

Merges [25932] to the 3.9 branch.

props SergeyBiryukov.
fixes #26775.

Location:
branches/3.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.8

  • branches/3.8/src/wp-includes/query.php

    r26946 r26951  
    116116function wp_reset_postdata() {
    117117        global $wp_query;
    118         $wp_query->reset_postdata();
     118
     119        if ( isset( $wp_query ) ) {
     120                $wp_query->reset_postdata();
     121        }
    119122}
    120123
Note: See TracChangeset for help on using the changeset viewer.