Ticket #16956: 16956.2.diff
File 16956.2.diff, 1.6 KB (added by , 12 years ago) |
---|
-
wp-includes/capabilities.php
1022 1022 } 1023 1023 1024 1024 $post_type = get_post_type_object( $post->post_type ); 1025 1026 if ( is_null( $post_type ) ) { 1027 $caps[] = 'do_not_allow'; 1028 break; 1029 } 1025 1030 1026 1031 if ( ! $post_type->map_meta_cap ) { 1027 1032 $caps[] = $post_type->cap->$cap; … … 1072 1077 } 1073 1078 1074 1079 $post_type = get_post_type_object( $post->post_type ); 1080 1081 if ( is_null( $post_type ) ) { 1082 $caps[] = 'do_not_allow'; 1083 break; 1084 } 1075 1085 1076 1086 if ( ! $post_type->map_meta_cap ) { 1077 1087 $caps[] = $post_type->cap->$cap; … … 1120 1130 } 1121 1131 1122 1132 $post_type = get_post_type_object( $post->post_type ); 1133 1134 if ( is_null( $post_type ) ) { 1135 $caps[] = 'do_not_allow'; 1136 break; 1137 } 1123 1138 1124 1139 if ( ! $post_type->map_meta_cap ) { 1125 1140 $caps[] = $post_type->cap->$cap; … … 1161 1176 case 'add_post_meta': 1162 1177 $post = get_post( $args[0] ); 1163 1178 $post_type_object = get_post_type_object( $post->post_type ); 1179 1180 if ( is_null( $post_type_object ) ) { 1181 $caps[] = 'do_not_allow'; 1182 break; 1183 } 1184 1164 1185 $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID ); 1165 1186 1166 1187 $meta_key = isset( $args[ 1 ] ) ? $args[ 1 ] : false; … … 1178 1199 $post = get_post( $comment->comment_post_ID ); 1179 1200 $post_type_object = get_post_type_object( $post->post_type ); 1180 1201 1202 if ( is_null( $post_type_object ) ) { 1203 $caps[] = 'do_not_allow'; 1204 break; 1205 } 1206 1181 1207 $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID ); 1182 1208 break; 1183 1209 case 'unfiltered_upload':