WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/26/2017 04:52:51 PM (3 years ago)
Author:
boonebgorges
Message:

Revert to pre-4.7 behavior for fetching object instances by id.

This changeset reverts [38381], which caused inconsistencies in the way the
REST API fetches posts and other objects.

See #38792, #37738.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-post.php

    r38951 r39992  
    211211        global $wpdb;
    212212
    213         if ( ! is_numeric( $post_id ) || $post_id != floor( $post_id ) || ! $post_id ) {
     213        $post_id = (int) $post_id;
     214        if ( ! $post_id ) {
    214215            return false;
    215216        }
    216 
    217         $post_id = (int) $post_id;
    218217
    219218        $_post = wp_cache_get( $post_id, 'posts' );
Note: See TracChangeset for help on using the changeset viewer.