From fa2f4b047acf53a96c1f6a03bf514ae45b1e70ed Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Tue, 4 Jul 2017 19:59:40 +0000 Subject: [PATCH] Avoid PHP notices when checking termmeta capabilities against a non-existent term. Previously, checks like `current_user_can( 'edit_term_meta', $term_id )` returned the proper value, but generated a PHP notice due to the fact that `get_term( $term_id )` could, in certain instances, return `WP_Error` objects. Props caercam. Fixes #40891. Built from https://develop.svn.wordpress.org/trunk@40999 git-svn-id: http://core.svn.wordpress.org/trunk@40849 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/capabilities.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index f40345deb9..13851cc2e1 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -280,7 +280,7 @@ function map_meta_cap( $cap, $user_id ) { case 'term': $term = get_term( $object_id ); - if ( ! $term ) { + if ( ! $term instanceof WP_Term ) { break; } diff --git a/wp-includes/version.php b/wp-includes/version.php index b95be9ae1a..c321cb7f35 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-alpha-40998'; +$wp_version = '4.9-alpha-40999'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.