Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: auth_post_meta_{$meta_key}

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1159      case 'delete_post_meta':
1160      case 'add_post_meta':
1161           $post = get_post( $args[0] );
1162           $post_type_object = get_post_type_object( $post->post_type );
1163           $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID );
1164
1165           $meta_key = isset( $args[ 1 ] ) ? $args[ 1 ] : false;
1166
1167           if ( $meta_key && has_filter( "auth_post_meta_{$meta_key}" ) ) {
1168                $allowed = apply_filters( "auth_post_meta_{$meta_key}", false, $meta_key, $post->ID, $user_id, $cap, $caps );
1169                if ( ! $allowed )
1170                     $caps[] = $cap;
1171           } elseif ( $meta_key && is_protected_meta( $meta_key, 'post' ) ) {
1172                $caps[] = $cap;
1173           }
1174           break;
1175      case 'edit_comment':
1176           $comment = get_comment( $args[0] );
1177           $post = get_post( $comment->comment_post_ID );