To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN
(without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 495 | $update = false; |
| 496 | if ( !empty($ID) ) { |
| 497 | $update = true; |
| 498 | $post = & get_post($ID); |
| 499 | $previous_status = $post->post_status; |
| 500 | } |
| 501 | |
| 502 | // Get the basics. |
| 503 | if ( empty($no_filter) ) { |
| 504 | $post_content = apply_filters('content_save_pre', $post_content); |
| 505 | $post_content_filtered = apply_filters('content_filtered_save_pre', $post_content_filtered); |
| 506 | $post_excerpt = apply_filters('excerpt_save_pre', $post_excerpt); |
| 507 | $post_title = apply_filters('title_save_pre', $post_title); |
| 508 | $post_category = apply_filters('category_save_pre', $post_category); |
| 509 | $post_status = apply_filters('status_save_pre', $post_status); |
| 510 | $post_name = apply_filters('name_save_pre', $post_name); |
| 511 | $comment_status = apply_filters('comment_status_pre', $comment_status); |
| 512 | $ping_status = apply_filters('ping_status_pre', $ping_status); |
| 513 | } |
| 514 | |
| 515 | if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) ) |
| 516 | return 0; |
| 517 | |
| 518 | // Make sure we set a valid category |
| 519 | if (0 == count($post_category) || !is_array($post_category)) { |
| 520 | $post_category = array(get_option('default_category')); |
| 521 | } |
| 522 | $post_cat = $post_category[0]; |
| 523 | |
| 524 | if ( empty($post_author) ) |
| 525 | $post_author = $user_ID; |
| Line | Code |
| 1216 | function wp_insert_attachment($object, $file = false, $post_parent = 0) { |
| 1217 | global $wpdb, $user_ID; |
| 1218 | |
| 1219 | if ( is_object($object) ) |
| 1220 | $object = get_object_vars($object); |
| 1221 | |
| 1222 | // Export array as variables |
| 1223 | extract($object); |
| 1224 | |
| 1225 | // Get the basics. |
| 1226 | $post_content = apply_filters('content_save_pre', $post_content); |
| 1227 | $post_content_filtered = apply_filters('content_filtered_save_pre', $post_content_filtered); |
| 1228 | $post_excerpt = apply_filters('excerpt_save_pre', $post_excerpt); |
| 1229 | $post_title = apply_filters('title_save_pre', $post_title); |
| 1230 | $post_category = apply_filters('category_save_pre', $post_category); |
| 1231 | $post_name = apply_filters('name_save_pre', $post_name); |
| 1232 | $comment_status = apply_filters('comment_status_pre', $comment_status); |
| 1233 | $ping_status = apply_filters('ping_status_pre', $ping_status); |
| 1234 | $post_mime_type = apply_filters('post_mime_type_pre', $post_mime_type); |
| 1235 | |
| 1236 | // Make sure we set a valid category |
| 1237 | if (0 == count($post_category) || !is_array($post_category)) { |
| 1238 | $post_category = array(get_option('default_category')); |
| 1239 | } |
| 1240 | $post_cat = $post_category[0]; |
| 1241 | |
| 1242 | if ( empty($post_author) ) |
| 1243 | $post_author = $user_ID; |
| 1244 | |
| 1245 | $post_type = 'attachment'; |
| 1246 | $post_status = 'inherit'; |