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.
Built from https://develop.svn.wordpress.org/trunk@39992


git-svn-id: http://core.svn.wordpress.org/trunk@39929 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges
2017-01-26 16:53:41 +00:00
parent 9463f7640b
commit fe1e3dba98
4 changed files with 7 additions and 10 deletions

View File

@@ -125,12 +125,11 @@ final class WP_Term {
public static function get_instance( $term_id, $taxonomy = null ) {
global $wpdb;
if ( ! is_numeric( $term_id ) || $term_id != floor( $term_id ) || ! $term_id ) {
$term_id = (int) $term_id;
if ( ! $term_id ) {
return false;
}
$term_id = (int) $term_id;
$_term = wp_cache_get( $term_id, 'terms' );
// If there isn't a cached version, hit the database.