mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@40999 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user