REST API: Capability check for editing a single term should use the singular form.

As an extra level of sanity checking, the term ID should be cast as an int in `map_meta_cap()`.

Props johnbillion, nacin, dd32, pento.
See #35614.
Fixes #39012.



git-svn-id: https://develop.svn.wordpress.org/trunk@39464 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2016-12-03 05:07:03 +00:00
parent eea9aed399
commit c4360e54b2
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -427,7 +427,7 @@ function map_meta_cap( $cap, $user_id ) {
case 'edit_term':
case 'delete_term':
case 'assign_term':
$term_id = $args[0];
$term_id = (int) $args[0];
$term = get_term( $term_id );
if ( ! $term || is_wp_error( $term ) ) {
$caps[] = 'do_not_allow';