Changeset 37924 for trunk/src/wp-includes/capabilities.php
- Timestamp:
- 06/30/2016 01:01:35 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/capabilities.php
r37518 r37924 244 244 } 245 245 246 $post_type = get_post_type( $post ); 247 246 248 $caps = map_meta_cap( 'edit_post', $user_id, $post->ID ); 247 249 248 250 $meta_key = isset( $args[ 1 ] ) ? $args[ 1 ] : false; 249 251 250 if ( $meta_key && has_filter( "auth_post_meta_{$meta_key}") ) {252 if ( $meta_key && ( has_filter( "auth_post_meta_{$meta_key}" ) || has_filter( "auth_post_{$post_type}_meta_{$meta_key}" ) ) ) { 251 253 /** 252 254 * Filters whether the user is allowed to add post meta to a post. … … 265 267 */ 266 268 $allowed = apply_filters( "auth_post_meta_{$meta_key}", false, $meta_key, $post->ID, $user_id, $cap, $caps ); 269 270 /** 271 * Filters whether the user is allowed to add post meta to a post of a given type. 272 * 273 * The dynamic portions of the hook name, `$meta_key` and `$post_type`, 274 * refer to the meta key passed to map_meta_cap() and the post type, respectively. 275 * 276 * @since 4.6.0 277 * 278 * @param bool $allowed Whether the user can add the post meta. Default false. 279 * @param string $meta_key The meta key. 280 * @param int $post_id Post ID. 281 * @param int $user_id User ID. 282 * @param string $cap Capability name. 283 * @param array $caps User capabilities. 284 */ 285 $allowed = apply_filters( "auth_post_{$post_type}_meta_{$meta_key}", $allowed, $meta_key, $post->ID, $user_id, $cap, $caps ); 286 267 287 if ( ! $allowed ) 268 288 $caps[] = $cap;
Note: See TracChangeset
for help on using the changeset viewer.