Ticket #25376: 25376.diff
File 25376.diff, 42.9 KB (added by , 11 years ago) |
---|
-
src/wp-includes/post.php
189 189 $file = $uploads['basedir'] . "/$file"; 190 190 if ( $unfiltered ) 191 191 return $file; 192 193 /** 194 * Filter the returned file path to an attached file. 195 * 196 * @since 197 * 198 * @param string $file Path to the attached file. 199 * @param int $attachment_id The attachment ID. 200 */ 192 201 return apply_filters( 'get_attached_file', $file, $attachment_id ); 193 202 } 194 203 … … 199 208 * '_wp_attached_file' to store the path of the attachment. 200 209 * 201 210 * @since 2.1.0 202 * @uses apply_filters() Calls 'update_attached_file' on file path and attachment ID.203 211 * 204 212 * @param int $attachment_id Attachment ID 205 213 * @param string $file File path for the attachment … … 209 217 if ( !get_post( $attachment_id ) ) 210 218 return false; 211 219 220 /** 221 * Filter the updated path to a file attached to a post. 222 * 223 * @since 224 * 225 * @param string $file Updated path to the file. 226 * @param int $attachment_id The attachment ID. 227 */ 212 228 $file = apply_filters( 'update_attached_file', $file, $attachment_id ); 213 229 if ( $file = _wp_relative_upload_path( $file ) ) 214 230 return update_post_meta( $attachment_id, '_wp_attached_file', $file ); … … 222 238 * The path is relative to the current upload dir. 223 239 * 224 240 * @since 2.9.0 225 * @uses apply_filters() Calls '_wp_relative_upload_path' on file path.226 241 * 227 242 * @param string $path Full path to the file 228 243 * @return string relative path on success, unchanged path on failure. … … 236 251 $new_path = ltrim( $new_path, '/' ); 237 252 } 238 253 254 /** 255 * Filter the relative path to an uploaded file. 256 * 257 * @since 258 * 259 * @param string $new_path Relative path to the uploaded file. 260 * @param string $path Original path to the uploaded file. 261 */ 239 262 return apply_filters( '_wp_relative_upload_path', $new_path, $path ); 240 263 } 241 264 … … 1331 1354 register_taxonomy_for_object_type( $taxonomy, $post_type ); 1332 1355 } 1333 1356 1357 /** 1358 * Fires after a post type has been registered. 1359 * 1360 * @since 1361 * 1362 * @param string $post_type The post type. 1363 * @param array $args An array of post type arguments. @see register_post_type() 1364 */ 1334 1365 do_action( 'registered_post_type', $post_type, $args ); 1335 1366 1336 1367 return $args; … … 1497 1528 $labels = _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults ); 1498 1529 1499 1530 $post_type = $post_type_object->name; 1531 1532 /** 1533 * Filter the labels for a post type. 1534 * 1535 * The dynamic portion of the hook name, $post_type, refers 1536 * to the slug used when registering the post type. 1537 * 1538 * @since 1539 * 1540 * @param array $labels An array of post type labels. 1541 */ 1500 1542 return apply_filters( "post_type_labels_{$post_type}", $labels ); 1501 1543 } 1502 1544 … … 1937 1979 * when calling filters. 1938 1980 * 1939 1981 * @since 2.3.0 1940 * @uses apply_filters() Calls 'edit_$field' and '{$field_no_prefix}_edit_pre' passing $value and1941 * $post_id if $context == 'edit' and field name prefix == 'post_'.1942 1982 * 1943 * @uses apply_filters() Calls 'edit_post_$field' passing $value and $post_id if $context == 'db'.1944 * @uses apply_filters() Calls 'pre_$field' passing $value if $context == 'db' and field name prefix == 'post_'.1945 * @uses apply_filters() Calls '{$field}_pre' passing $value if $context == 'db' and field name prefix != 'post_'.1946 *1947 * @uses apply_filters() Calls '$field' passing $value, $post_id and $context if $context == anything1948 * other than 'raw', 'edit' and 'db' and field name prefix == 'post_'.1949 * @uses apply_filters() Calls 'post_$field' passing $value if $context == anything other than 'raw',1950 * 'edit' and 'db' and field name prefix != 'post_'.1951 *1952 1983 * @param string $field The Post Object field name. 1953 1984 * @param mixed $value The Post Object value. 1954 1985 * @param int $post_id Post ID. … … 1981 2012 $format_to_edit = array('post_content', 'post_excerpt', 'post_title', 'post_password'); 1982 2013 1983 2014 if ( $prefixed ) { 1984 $value = apply_filters("edit_{$field}", $value, $post_id); 1985 // Old school 1986 $value = apply_filters("{$field_no_prefix}_edit_pre", $value, $post_id); 2015 /** 2016 * Filter a prefixed post field prior to being sanitized for the 'edit' context. 2017 * 2018 * The dynamic portion of the hook name, $field, refers 2019 * to the prefixed post field being filtered, such as 2020 * 'post_content', 'post_excerpt', 'post_title', etc. 2021 * 2022 * @since 2023 * 2024 * @param mixed $value Value of the prefixed post field. 2025 * @param int $post_id The post ID. 2026 */ 2027 $value = apply_filters( "edit_{$field}", $value, $post_id ); 2028 /** 2029 * Filter a prefixed post field prior to being sanitized for the 'edit' context. 2030 * 2031 * The dynamic portion of the hook name, $field_no_prefix. refers to normally-prefixed 2032 * post fields with the 'post_' prefix removed. 2033 * 2034 * @since 2035 * 2036 * @param mixed $value Value of the non-prefixed post field. 2037 * @param int $post_id The post ID. 2038 */ 2039 $value = apply_filters( "{$field_no_prefix}_edit_pre", $value, $post_id ); 1987 2040 } else { 1988 $value = apply_filters("edit_post_{$field}", $value, $post_id); 2041 /** 2042 * Filter a non-prefixed post field prior to being sanitized for the 'edit' context. 2043 * 2044 * The dynamic portion of the hook name, $field. refers to fields with names 2045 * lacking the 'post_' prefix. 2046 * 2047 * @since 2048 * 2049 * @param mixed $value Value of the post field. 2050 * @param int $post_id The post ID. 2051 */ 2052 $value = apply_filters( "edit_post_{$field}", $value, $post_id ); 1989 2053 } 1990 2054 1991 2055 if ( in_array($field, $format_to_edit) ) { … … 1998 2062 } 1999 2063 } else if ( 'db' == $context ) { 2000 2064 if ( $prefixed ) { 2001 $value = apply_filters("pre_{$field}", $value); 2002 $value = apply_filters("{$field_no_prefix}_save_pre", $value); 2065 /** 2066 * Filter a prefixed post field prior to being sanitized for the 'db' context. 2067 * 2068 * The dynamic portion of the hook name, $field, refers to the name 2069 * of the post field, such as 'post_content', 'post_title', etc. 2070 * 2071 * @since 2072 * 2073 * @param mixed $value Value of the post field. 2074 */ 2075 $value = apply_filters( "pre_{$field}", $value ); 2076 /** 2077 * Filter the non-prefixed post field prior to being sanitized for the 'db' context. 2078 * 2079 * The dynamic portion of the hook name, $field_no_prefix. refers to normally-prefixed 2080 * post fields with the 'post_' prefix removed. 2081 * 2082 * @since 2083 * 2084 * @param mixed $value Value of the post field. 2085 */ 2086 $value = apply_filters( "{$field_no_prefix}_save_pre", $value ); 2003 2087 } else { 2004 $value = apply_filters("pre_post_{$field}", $value); 2005 $value = apply_filters("{$field}_pre", $value); 2088 /** 2089 * Filter a non-prefixed post field prior to being sanitized for the 'db' context. 2090 * 2091 * The dynamic portion of the hook name, $field. refers to fields with names 2092 * lacking the 'post_' prefix. 2093 * 2094 * @since 2095 * 2096 * @param mixed $value Value of the post field. 2097 */ 2098 $value = apply_filters( "pre_post_{$field}", $value ); 2099 /** 2100 * Filter a non-prefixed post field prior to being sanitized for the 'db' context. 2101 * 2102 * The dynamic portion of the hook name, $field, refers to fields with names 2103 * lacking the 'post_' prefix. 2104 * 2105 * @since 2106 * 2107 * @param mixed $value Value of the post field. 2108 */ 2109 $value = apply_filters( "{$field}_pre", $value ); 2006 2110 } 2007 2111 } else { 2008 2112 // Use display filters by default. 2009 if ( $prefixed ) 2010 $value = apply_filters($field, $value, $post_id, $context); 2011 else 2113 if ( $prefixed ) { 2114 /** 2115 * Filter a prefixed post field prior to being sanitized for a context other than 'edit' or 'db'. 2116 * 2117 * @since 2118 * 2119 * @param string $field The prefixed post field name. 2120 * @param mixed $value Value of the post field. 2121 * @param int $post_id The post ID. 2122 * @param string $context The context to sanitize the post field in. 2123 */ 2124 $value = apply_filters( $field, $value, $post_id, $context ); 2125 } else { 2126 /** 2127 * Filter a non-prefixed post field prior to being sanitized for a context other than 'edit' or 'db'. 2128 * 2129 * The dynamic portion of the hook name, $field, refers to fields with names 2130 * lacking the 'post_' prefix. 2131 * 2132 * @since 2133 * 2134 * @param mixed $value Value of the post field. 2135 * @param int $post_id The post ID. 2136 * @param string $context The context to sanitize the post field in. 2137 */ 2012 2138 $value = apply_filters("post_{$field}", $value, $post_id, $context); 2139 } 2013 2140 } 2014 2141 2015 2142 if ( 'attribute' == $context ) … … 2181 2308 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')), 2182 2309 ); 2183 2310 2311 /** 2312 * Filter the default post mime types. 2313 * 2314 * @since 2315 * 2316 * @param array $post_mime_types An array of post mime types. 2317 */ 2184 2318 return apply_filters('post_mime_types', $post_mime_types); 2185 2319 } 2186 2320 … … 2278 2412 * disabled, item is already in the trash, or $force_delete is true. 2279 2413 * 2280 2414 * @since 1.0.0 2281 * @uses do_action() on 'delete_post' before deletion unless post type is 'attachment'.2282 * @uses do_action() on 'deleted_post' after deletion unless post type is 'attachment'.2283 2415 * @uses wp_delete_attachment() if post type is 'attachment'. 2284 2416 * @uses wp_trash_post() if item should be trashed. 2285 2417 * … … 2299 2431 if ( $post->post_type == 'attachment' ) 2300 2432 return wp_delete_attachment( $postid, $force_delete ); 2301 2433 2302 do_action('before_delete_post', $postid); 2434 /** 2435 * Fires after a post is trashed, but before any post data is deleted. 2436 * 2437 * Attachments are deleted separately. @see wp_delete_attachment() 2438 * 2439 * @since 2440 * 2441 * @param int $postid The post ID. 2442 */ 2443 do_action( 'before_delete_post', $postid ); 2303 2444 2304 2445 delete_post_meta($postid,'_wp_trash_meta_status'); 2305 2446 delete_post_meta($postid,'_wp_trash_meta_time'); … … 2348 2489 foreach ( $post_meta_ids as $mid ) 2349 2490 delete_metadata_by_mid( 'post', $mid ); 2350 2491 2492 /** 2493 * Fires after post data is deleted, but before the post is deleted. 2494 * 2495 * Attachments are deleted separately. @see wp_delete_attachment() 2496 * 2497 * @since 2498 * 2499 * @param int $postid The post ID. 2500 */ 2351 2501 do_action( 'delete_post', $postid ); 2352 2502 $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) ); 2503 /** 2504 * Fires after a post has been deleted. 2505 * 2506 * Attachments are deleted separately. @see wp_delete_attachment() 2507 * 2508 * @since 2509 * 2510 * @param int $postid The post ID. 2511 */ 2353 2512 do_action( 'deleted_post', $postid ); 2354 2513 2355 2514 clean_post_cache( $post ); … … 2361 2520 2362 2521 wp_clear_scheduled_hook('publish_future_post', array( $postid ) ); 2363 2522 2364 do_action('after_delete_post', $postid); 2523 /** 2524 * Fires after a post is deleted and post caches are cleaned. 2525 * 2526 * Attachments are deleted separately. @see wp_delete_attachment() 2527 * 2528 * @since 2529 * 2530 * @param int $postid The post ID. 2531 */ 2532 do_action( 'after_delete_post', $postid ); 2365 2533 2366 2534 return $post; 2367 2535 } … … 2372 2540 * If trash is disabled, the post or page is permanently deleted. 2373 2541 * 2374 2542 * @since 2.9.0 2375 * @uses do_action() on 'trash_post' before trashing2376 * @uses do_action() on 'trashed_post' after trashing2377 2543 * @uses wp_delete_post() if trash is disabled 2378 2544 * 2379 2545 * @param int $post_id Post ID. … … 2389 2555 if ( $post['post_status'] == 'trash' ) 2390 2556 return false; 2391 2557 2392 do_action('wp_trash_post', $post_id); 2558 /** 2559 * Fires before a post is sent to the trash. 2560 * 2561 * @since 2562 * 2563 * @param int $post_id The post ID. 2564 */ 2565 do_action( 'wp_trash_post', $post_id ); 2393 2566 2394 2567 add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']); 2395 2568 add_post_meta($post_id,'_wp_trash_meta_time', time()); … … 2399 2572 2400 2573 wp_trash_post_comments($post_id); 2401 2574 2402 do_action('trashed_post', $post_id); 2575 /** 2576 * Fires after a post is sent to the trash. 2577 * 2578 * @since 2579 * 2580 * @param int $post_id The post ID. 2581 */ 2582 do_action( 'trashed_post', $post_id ); 2403 2583 2404 2584 return $post; 2405 2585 } … … 2408 2588 * Restores a post or page from the Trash 2409 2589 * 2410 2590 * @since 2.9.0 2411 * @uses do_action() on 'untrash_post' before undeletion2412 * @uses do_action() on 'untrashed_post' after undeletion2413 2591 * 2414 2592 * @param int $post_id Post ID. 2415 2593 * @return mixed False on failure … … 2421 2599 if ( $post['post_status'] != 'trash' ) 2422 2600 return false; 2423 2601 2424 do_action('untrash_post', $post_id); 2602 /** 2603 * Fires before a post is restored from the trash. 2604 * 2605 * @since 2606 * 2607 * @parma int $post_id The post ID. 2608 */ 2609 do_action( 'untrash_post', $post_id ); 2425 2610 2426 2611 $post_status = get_post_meta($post_id, '_wp_trash_meta_status', true); 2427 2612 … … 2434 2619 2435 2620 wp_untrash_post_comments($post_id); 2436 2621 2437 do_action('untrashed_post', $post_id); 2622 /** 2623 * Fires after a post has been restored from the trash. 2624 * 2625 * @since 2626 * 2627 * @param int $post_id The post ID. 2628 */ 2629 do_action( 'untrashed_post', $post_id ); 2438 2630 2439 2631 return $post; 2440 2632 } … … 2443 2635 * Moves comments for a post to the trash 2444 2636 * 2445 2637 * @since 2.9.0 2446 * @uses do_action() on 'trash_post_comments' before trashing2447 * @uses do_action() on 'trashed_post_comments' after trashing2448 2638 * 2449 2639 * @param int|object $post Post ID or object. 2450 2640 * @return mixed False on failure … … 2458 2648 2459 2649 $post_id = $post->ID; 2460 2650 2461 do_action('trash_post_comments', $post_id); 2651 /** 2652 * Fires before post comments have been sent to the trash. 2653 * 2654 * @since 2655 * 2656 * @param int $post_id The post ID. 2657 */ 2658 do_action( 'trash_post_comments', $post_id ); 2462 2659 2463 2660 $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id) ); 2464 2661 if ( empty($comments) ) … … 2475 2672 2476 2673 clean_comment_cache( array_keys($statuses) ); 2477 2674 2478 do_action('trashed_post_comments', $post_id, $statuses); 2675 /** 2676 * Fires after post comments have been sent to the trash. 2677 * 2678 * @since 2679 * 2680 * @param int $post_id The post ID. 2681 * @param array $statuses An array of post comment statuses. 2682 */ 2683 do_action( 'trashed_post_comments', $post_id, $statuses ); 2479 2684 2480 2685 return $result; 2481 2686 } … … 2484 2689 * Restore comments for a post from the trash 2485 2690 * 2486 2691 * @since 2.9.0 2487 * @uses do_action() on 'untrash_post_comments' before trashing2488 * @uses do_action() on 'untrashed_post_comments' after trashing2489 2692 * 2490 2693 * @param int|object $post Post ID or object. 2491 2694 * @return mixed False on failure … … 2504 2707 if ( empty($statuses) ) 2505 2708 return true; 2506 2709 2507 do_action('untrash_post_comments', $post_id); 2710 /** 2711 * Fires before post comments are restored from the trash. 2712 * 2713 * @since 2714 * 2715 * @param int $post_id The post ID. 2716 */ 2717 do_action( 'untrash_post_comments', $post_id ); 2508 2718 2509 2719 // Restore each comment to its original status 2510 2720 $group_by_status = array(); … … 2523 2733 2524 2734 delete_post_meta($post_id, '_wp_trash_meta_comments_status'); 2525 2735 2526 do_action('untrashed_post_comments', $post_id); 2736 /** 2737 * Fires after post comments have been restored from the trash. 2738 * 2739 * @since 2740 * 2741 * @param int $post_id The post ID. 2742 */ 2743 do_action( 'untrashed_post_comments', $post_id ); 2527 2744 } 2528 2745 2529 2746 /** … … 2672 2889 * @since 1.0.0 2673 2890 * @uses $wpdb 2674 2891 * @uses $user_ID 2675 * @uses do_action() Calls 'pre_post_update' on post ID if this is an update.2676 * @uses do_action() Calls 'edit_post' action on post ID and post data if this is an update.2677 * @uses do_action() Calls 'save_post_{$post_type}', 'save_post' and 'wp_insert_post' on post id and post data just before returning.2678 * @uses apply_filters() Calls 'wp_insert_post_data' passing $data, $postarr prior to database update or insert.2679 2892 * @uses wp_transition_post_status() 2680 2893 * 2681 2894 * @param array $postarr Elements that make up post to insert. … … 2724 2937 $maybe_empty = ! $post_content && ! $post_title && ! $post_excerpt && post_type_supports( $post_type, 'editor' ) 2725 2938 && post_type_supports( $post_type, 'title' ) && post_type_supports( $post_type, 'excerpt' ); 2726 2939 2940 /** 2941 * Filter whether to flag content as empty when inserting or updating a post. 2942 * 2943 * $maybe_empty is derived from a mix of conditionals testing if $post_content, $post_title, and $post_excerpt 2944 * are empty, as well as if the post type supports 'editor', 'title', and 'excerpt. 2945 * 2946 * @since 2947 * 2948 * @param bool $maybe_empty Whether content, title, and excerpt are empty. 2949 * @param array $postarr An array of post fields passed to wp_insert_post(). 2950 */ 2727 2951 if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) { 2728 2952 if ( $wp_error ) 2729 2953 return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) ); … … 2835 3059 else 2836 3060 $post_parent = 0; 2837 3061 2838 // Check the post_parent to see if it will cause a hierarchy loop 3062 $prepared_postarr = compact( array_keys( $postarr ) ); 3063 /** 3064 * Filter the post parent ID prior to inserting or updating a post. 3065 * 3066 * Allows checking the post_parent for a hierarchy loop. 3067 * 3068 * @since 3069 * 3070 * @param int $post_parent The post parent ID. 3071 * @param int $post_ID The post ID. 3072 * @param array $prepared_postarr A compacted array of $postarr fields modified from default values. 3073 * @param array $postarr An array of post fields sanitized in the 'db' context. @see sanitize_post() 3074 * 3075 */ 2839 3076 $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr ); 2840 3077 2841 3078 if ( isset($menu_order) ) … … 2850 3087 2851 3088 // expected_slashed (everything!) 2852 3089 $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) ); 2853 $data = apply_filters('wp_insert_post_data', $data, $postarr); 3090 /** 3091 * Filter slashed post data to insert in a new or existing post. 3092 * 3093 * @since 3094 * 3095 * @param array $data A prepared array of post fields and their values. 3096 * @param array $postarr An array of post fields sanitized in the 'db' context. @see sanitize_post() 3097 */ 3098 $data = apply_filters( 'wp_insert_post_data', $data, $postarr ); 2854 3099 $data = wp_unslash( $data ); 2855 3100 $where = array( 'ID' => $post_ID ); 2856 3101 2857 3102 if ( $update ) { 3103 /** 3104 * Fires before an existing post is updated. 3105 * 3106 * @since 3107 * 3108 * @param int $post_ID The post ID. 3109 * @param array $data A prepared array of post fields and their values. 3110 */ 2858 3111 do_action( 'pre_post_update', $post_ID, $data ); 2859 3112 if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { 2860 3113 if ( $wp_error ) … … 2931 3184 wp_transition_post_status($data['post_status'], $previous_status, $post); 2932 3185 2933 3186 if ( $update ) { 2934 do_action('edit_post', $post_ID, $post); 3187 /** 3188 * Fires before a post is updated. 3189 * 3190 * @since 3191 * 3192 * @param int $post_ID The post ID. 3193 * @param WP_Post $post The WP_Post object. 3194 */ 3195 do_action( 'edit_post', $post_ID, $post ); 2935 3196 $post_after = get_post($post_ID); 3197 /** 3198 * Fires after a post is updated. 3199 * 3200 * @since 3201 * 3202 * @param int $post_ID The post ID. 3203 * @param WP_Post $post_after The WP_Post object after being updated. 3204 * @param WP_Post $post_before The WP_Post object before being updated. 3205 */ 2936 3206 do_action( 'post_updated', $post_ID, $post_after, $post_before); 2937 3207 } 2938 3208 3209 /** 3210 * Fires when a post of a particular post type is saved. 3211 * 3212 * The dynamic portion of the hook name, $post->post_type, refers to the post type slug. 3213 * 3214 * @since 3215 * 3216 * @param int $post_ID The post ID. 3217 * @param WP_Post $post The WP_Post object. 3218 * @param bool $update Whether the post is being updated or created. True for updated, false for created. 3219 */ 2939 3220 do_action( "save_post_{$post->post_type}", $post_ID, $post, $update ); 3221 /** 3222 * Fires when a post is saved. 3223 * 3224 * @since 3225 * 3226 * @param int $post_ID The post ID. 3227 * @param WP_Post $post The WP_Post object. 3228 * @param bool $update Whether the post is being updated or created. True for updated, false for created. 3229 */ 2940 3230 do_action( 'save_post', $post_ID, $post, $update ); 3231 /** 3232 * Fires when a post is updated or inserted. 3233 * 3234 * @since 3235 * 3236 * @param int $post_ID The post ID. 3237 * @param WP_Post $post The WP_Post object. 3238 * @param bool $update Whether the post is being updated or created. True for updated, false for created. 3239 */ 2941 3240 do_action( 'wp_insert_post', $post_ID, $post, $update ); 2942 3241 2943 3242 return $post_ID; … … 3007 3306 * 3008 3307 * @since 2.1.0 3009 3308 * @uses $wpdb 3010 * @uses do_action() Calls 'edit_post', 'save_post_{$post_type}', 'save_post' and 'wp_insert_post' on post_id and post data.3011 3309 * 3012 3310 * @param int|object $post Post ID or object. 3013 3311 */ … … 3028 3326 $post->post_status = 'publish'; 3029 3327 wp_transition_post_status( 'publish', $old_status, $post ); 3030 3328 3329 /** 3330 * Fires after a post has been published and post status changed. 3331 * 3332 * @since 3333 * 3334 * @param int $post->ID The post ID. 3335 * @param WP_Post $post The WP_Post object. 3336 */ 3031 3337 do_action( 'edit_post', $post->ID, $post ); 3338 //duplicate_hook 3032 3339 do_action( "save_post_{$post->post_type}", $post->ID, $post, true ); 3340 //duplicate_hook 3033 3341 do_action( 'save_post', $post->ID, $post, true ); 3342 //duplicate_hook 3034 3343 do_action( 'wp_insert_post', $post->ID, $post, true ); 3035 3344 } 3036 3345 … … 3078 3387 * @param string $post_status no uniqueness checks are made if the post is still draft or pending 3079 3388 * @param string $post_type 3080 3389 * @param integer $post_parent 3081 * @return string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)3390 * @return string Zunique slug for the post, based on $post_name (with a -1, -2, etc. suffix) 3082 3391 */ 3083 3392 function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) { 3084 3393 if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) ) … … 3098 3407 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1"; 3099 3408 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) ); 3100 3409 3410 /** 3411 * Filter whether a unique post slug is a bad attachment slug. 3412 * 3413 * @since 3414 * 3415 * @param bool false Whether a unique post slug is flagged as a bad attachment slug. Default false. 3416 * @param string $slug The post slug. 3417 */ 3101 3418 if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) { 3102 3419 $suffix = 2; 3103 3420 do { … … 3115 3432 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d LIMIT 1"; 3116 3433 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) ); 3117 3434 3435 /** 3436 * Filter whether a unique post slug is a bad hierarchical slug. 3437 * 3438 * @since 3439 * 3440 * @param bool false Whether a unique post slug is flagged as a bad idea for a hierarchical slug. Default false. 3441 * @param string $post_type The post type. 3442 * @param int $post_parent The post parent ID. 3443 */ 3118 3444 if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) ) { 3119 3445 $suffix = 2; 3120 3446 do { … … 3129 3455 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; 3130 3456 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); 3131 3457 3458 /** 3459 * Filter whether a unique post slug is a bad flat slug. 3460 * 3461 * @since 3462 * 3463 * @param bool false Whether the slug is a bad flat slug. 3464 * @param string $slug The unique post slug. 3465 * @param string $post_type The post type. 3466 */ 3132 3467 if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) { 3133 3468 $suffix = 2; 3134 3469 do { … … 3140 3475 } 3141 3476 } 3142 3477 3478 /** 3479 * Filter the returned unique post slug. 3480 * 3481 * The slug is ased on $post_name (with a -1, -2, etc. suffix). 3482 * 3483 * @since 3484 * 3485 * @param string $slug The unique post slug. 3486 * @param int $post_ID The post ID. 3487 * @param string $post_status The post status. 3488 * @param string $post_type The post type. 3489 * @param int $post_parent The post parent ID. 3490 * @param string $original_slug The original post slug. 3491 */ 3143 3492 return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ); 3144 3493 } 3145 3494 … … 3285 3634 * @since 2.3.0 3286 3635 * @link http://codex.wordpress.org/Post_Status_Transitions 3287 3636 * 3288 * @uses do_action() Calls 'transition_post_status' on $new_status, $old_status and3289 * $post if there is a status change.3290 * @uses do_action() Calls '{$old_status}_to_{$new_status}' on $post if there is a status change.3291 * @uses do_action() Calls '{$new_status}_{$post->post_type}' on post ID and $post.3292 *3293 3637 * @param string $new_status Transition to this post status. 3294 3638 * @param string $old_status Previous post status. 3295 3639 * @param object $post Post data. 3296 3640 */ 3297 3641 function wp_transition_post_status($new_status, $old_status, $post) { 3298 do_action('transition_post_status', $new_status, $old_status, $post); 3299 do_action("{$old_status}_to_{$new_status}", $post); 3300 do_action("{$new_status}_{$post->post_type}", $post->ID, $post); 3642 /** 3643 * Fires before a post status has transitioned from one to another 3644 * 3645 * @since 3646 * 3647 * @param string $new_status The new post status. 3648 * @param string $old_status The old post status. 3649 * @param WP_Post $post The WP_Post object. 3650 */ 3651 do_action( 'transition_post_status', $new_status, $old_status, $post ); 3652 /** 3653 * Fires before a post status has transitioned from one specific status to another. 3654 * 3655 * The dynamic portions of the hook nam, $old_status, and $new_status, refer to the post 3656 * status the post is changing from and to, respectively. Use this hook for targeting 3657 * specific post status transitions. 3658 * 3659 * @since 3660 * 3661 * @param WP_Post $post The WP_Post object. 3662 */ 3663 do_action( "{$old_status}_to_{$new_status}", $post ); 3664 /** 3665 * Fires before a post of a particular post type's status has transitioned from one to another. 3666 * 3667 * The dynamic portions of the hook name, $new_status, and $post->post_type, refer to the post 3668 * status the post is transitioning to, and the slug of the post type being updated, respectively. 3669 * Use this hook for targeting specific new post status changes for a specific post type. 3670 * 3671 * @since 3672 * 3673 * @param int $post->ID The post ID. 3674 * @param WP_Post $post The WP_Post object. 3675 */ 3676 do_action( "{$new_status}_{$post->post_type}", $post->ID, $post ); 3301 3677 } 3302 3678 3303 3679 // … … 3321 3697 $pung = preg_split('/\s/', $pung); 3322 3698 $pung[] = $uri; 3323 3699 $new = implode("\n", $pung); 3324 $new = apply_filters('add_ping', $new); 3700 /** 3701 * Filter a ping before it is added to the 'pinged' list in the database. 3702 * 3703 * The returned value is expected to be slashed. 3704 * 3705 * @since 3706 * 3707 * @param string $new The new ping URL to add. 3708 */ 3709 $new = apply_filters( 'add_ping', $new ); 3325 3710 // expected_slashed ($new) 3326 3711 $new = wp_unslash($new); 3327 3712 return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) ); … … 3349 3734 $pung[] = trim( $enclosure[ 0 ] ); 3350 3735 } 3351 3736 } 3737 3738 /** 3739 * 3740 * 3741 * @since 3742 * 3743 * @param string $pung The pinged URI. 3744 * @param int $post_id The post ID. 3745 */ 3352 3746 $pung = apply_filters('get_enclosed', $pung, $post_id); 3353 3747 return $pung; 3354 3748 } … … 3367 3761 $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id )); 3368 3762 $pung = trim($pung); 3369 3763 $pung = preg_split('/\s/', $pung); 3764 /** 3765 * Filter the URLs already pinged for a post. 3766 * 3767 * @since 3768 * 3769 * @param string $pung A list of already-pinged URLs for the post. 3770 */ 3370 3771 $pung = apply_filters('get_pung', $pung); 3371 3772 return $pung; 3372 3773 } … … 3385 3786 $to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id )); 3386 3787 $to_ping = sanitize_trackback_urls( $to_ping ); 3387 3788 $to_ping = preg_split('/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY); 3388 $to_ping = apply_filters('get_to_ping', $to_ping); 3789 /** 3790 * Filter the URLs that need to be pinged. 3791 * 3792 * @since 3793 * 3794 * @param string $to_ping A list of URLs still to ping for a post. 3795 */ 3796 $to_ping = apply_filters( 'get_to_ping', $to_ping ); 3389 3797 return $to_ping; 3390 3798 } 3391 3799 … … 3713 4121 if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) { 3714 4122 // Convert to WP_Post instances 3715 4123 $pages = array_map( 'get_post', $cache ); 3716 $pages = apply_filters('get_pages', $pages, $r); 4124 /** 4125 * Filter the array of cached page objects to return in get_pages(). 4126 * 4127 * @since 4128 * 4129 * @param array $pages An array of WP_Post page objects. 4130 * @param array $r An array of arguments for getting pages. @see get_pages() 4131 */ 4132 $pages = apply_filters( 'get_pages', $pages, $r ); 3717 4133 return $pages; 3718 4134 } 3719 4135 … … 3843 4259 $pages = $wpdb->get_results($query); 3844 4260 3845 4261 if ( empty($pages) ) { 3846 $pages = apply_filters('get_pages', array(), $r); 4262 /** 4263 * Filter the array of pages returned when no pages are found. 4264 * 4265 * @since 4266 * 4267 * @param array The empty array returned when no pages are found. 4268 * @param array $r An array of arguments for getting pages. @see get_pages() 4269 */ 4270 $pages = apply_filters( 'get_pages', array(), $r ); 3847 4271 return $pages; 3848 4272 } 3849 4273 … … 3882 4306 // Convert to WP_Post instances 3883 4307 $pages = array_map( 'get_post', $pages ); 3884 4308 3885 $pages = apply_filters('get_pages', $pages, $r); 4309 /** 4310 * Filter the returned array of found pages. 4311 * 4312 * @since 4313 * 4314 * @param array $pages The array of pages found. 4315 * @param array $r An array of arguments for getting pages. @see get_pages() 4316 */ 4317 $pages = apply_filters( 'get_pages', $pages, $r ); 3886 4318 3887 4319 return $pages; 3888 4320 } … … 3945 4377 * @since 2.0.0 3946 4378 * @uses $wpdb 3947 4379 * @uses $user_ID 3948 * @uses do_action() Calls 'edit_attachment' on $post_ID if this is an update.3949 * @uses do_action() Calls 'add_attachment' on $post_ID if this is not an update.3950 4380 * 3951 4381 * @param string|array $object Arguments to override defaults. 3952 4382 * @param string $file Optional filename. … … 4096 4526 add_post_meta( $post_ID, '_wp_attachment_context', $context, true ); 4097 4527 4098 4528 if ( $update) { 4099 do_action('edit_attachment', $post_ID); 4529 /** 4530 * Fires after an attachment is updated. 4531 * 4532 * @since 4533 * 4534 * @param int $post_ID The post ID. 4535 */ 4536 do_action( 'edit_attachment', $post_ID ); 4100 4537 } else { 4101 do_action('add_attachment', $post_ID); 4538 /** 4539 * Fires after an attachment is added. 4540 * 4541 * @since 4542 * 4543 * @param int $post_ID The post ID. 4544 */ 4545 do_action( 'add_attachment', $post_ID ); 4102 4546 } 4103 4547 4104 4548 return $post_ID; … … 4116 4560 * 4117 4561 * @since 2.0.0 4118 4562 * @uses $wpdb 4119 * @uses do_action() Calls 'delete_attachment' hook on Attachment ID.4120 4563 * 4121 4564 * @param int $post_id Attachment ID. 4122 4565 * @param bool $force_delete Whether to bypass trash and force deletion. Defaults to false. … … 4150 4593 if ( is_multisite() ) 4151 4594 delete_transient( 'dirsize_cache' ); 4152 4595 4153 do_action('delete_attachment', $post_id); 4596 /** 4597 * Fires after an attachment has been trashed, but before its meta data is deleted. 4598 * 4599 * @since 4600 * 4601 * @param int $post_id The post ID. 4602 */ 4603 do_action( 'delete_attachment', $post_id ); 4154 4604 4155 4605 wp_delete_object_term_relationships($post_id, array('category', 'post_tag')); 4156 4606 wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type)); … … 4165 4615 foreach ( $post_meta_ids as $mid ) 4166 4616 delete_metadata_by_mid( 'post', $mid ); 4167 4617 4618 /** 4619 * Fires after an attachment's meta data has been deleted, but before the attachment is deleted. 4620 * 4621 * @since 4622 * 4623 * @param int $post_id The post ID. 4624 */ 4168 4625 do_action( 'delete_post', $post_id ); 4169 4626 $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) ); 4627 /** 4628 * Fires after an attachment has been deleted. 4629 * 4630 * @since 4631 * 4632 * @param int $post_id The post ID. 4633 */ 4170 4634 do_action( 'deleted_post', $post_id ); 4171 4635 4172 4636 $uploadpath = wp_upload_dir(); … … 4175 4639 // Don't delete the thumb if another attachment uses it 4176 4640 if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $meta['thumb'] . '%', $post_id)) ) { 4177 4641 $thumbfile = str_replace(basename($file), $meta['thumb'], $file); 4178 $thumbfile = apply_filters('wp_delete_file', $thumbfile); 4642 /** 4643 * Filter the path to a thumbnail-sized image being deleted. 4644 * 4645 * @since 4646 * 4647 * @param string $thumbfile Path to the thumbnail-sized image to be deleted. 4648 */ 4649 $thumbfile = apply_filters( 'wp_delete_file', $thumbfile ); 4179 4650 @ unlink( path_join($uploadpath['basedir'], $thumbfile) ); 4180 4651 } 4181 4652 } 4182 4653 4183 4654 // remove intermediate and backup images if there are any 4184 4655 foreach ( $intermediate_sizes as $intermediate ) { 4656 /** 4657 * Filter the path to a intermediate-sized image being deleted. 4658 * 4659 * @since 4660 * 4661 * @param string $intermediate['path'] Path to the intermediate-sized image to be deleted. 4662 */ 4185 4663 $intermediate_file = apply_filters( 'wp_delete_file', $intermediate['path'] ); 4186 4664 @ unlink( path_join($uploadpath['basedir'], $intermediate_file) ); 4187 4665 } … … 4189 4667 if ( is_array($backup_sizes) ) { 4190 4668 foreach ( $backup_sizes as $size ) { 4191 4669 $del_file = path_join( dirname($meta['file']), $size['file'] ); 4192 $del_file = apply_filters('wp_delete_file', $del_file); 4670 /** 4671 * Filter the path to an other-sized image being deleted. 4672 * 4673 * @since 4674 * 4675 * @param string $del_file Path to the other-sized image to be deleted. 4676 */ 4677 $del_file = apply_filters( 'wp_delete_file', $del_file ); 4193 4678 @ unlink( path_join($uploadpath['basedir'], $del_file) ); 4194 4679 } 4195 4680 } 4196 4681 4197 $file = apply_filters('wp_delete_file', $file); 4682 /** 4683 * Filter the path to the file to be deleted. 4684 * 4685 * @since 4686 * 4687 * @param string $file Path to the file. 4688 */ 4689 $file = apply_filters( 'wp_delete_file', $file ); 4198 4690 4199 4691 if ( ! empty($file) ) 4200 4692 @ unlink($file); … … 4223 4715 if ( $unfiltered ) 4224 4716 return $data; 4225 4717 4718 /** 4719 * Filter the returned meta data for an attachment. 4720 * 4721 * @since 4722 * 4723 * @param array $data An array of attachment metadata. 4724 * @param int $post->ID The attachment post ID. 4725 */ 4226 4726 return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID ); 4227 4727 } 4228 4728 … … 4240 4740 if ( !$post = get_post( $post_id ) ) 4241 4741 return false; 4242 4742 4743 /** 4744 * Filter the attachment meta data to be updated. 4745 * 4746 * @since 4747 * 4748 * @param array $data An array of attachment meta data. 4749 * @param int $post->ID The attachment post ID. 4750 */ 4243 4751 if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) ) 4244 4752 return update_post_meta( $post->ID, '_wp_attachment_metadata', $data ); 4245 4753 else … … 4277 4785 if ( empty($url) ) //If any of the above options failed, Fallback on the GUID as used pre-2.7, not recommended to rely upon this. 4278 4786 $url = get_the_guid( $post->ID ); 4279 4787 4788 /** 4789 * Filter the attachment URL. 4790 * 4791 * @since 4792 * 4793 * @param string $url The URL to the attachment. 4794 * @param int $post->ID The attachment post ID. 4795 */ 4280 4796 $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID ); 4281 4797 4282 4798 if ( empty( $url ) ) … … 4302 4818 4303 4819 $file = get_attached_file( $post->ID ); 4304 4820 4305 if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) 4821 if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) { 4822 /** 4823 * Filter the path to the attachment thumbnail image. 4824 * 4825 * @since 4826 * 4827 * @param string $thumbfile Path to the attachment thumbnail image. 4828 * @param int $post->ID The attachment post ID. 4829 */ 4306 4830 return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID ); 4831 } 4307 4832 return false; 4308 4833 } 4309 4834 … … 4331 4856 4332 4857 $url = str_replace(basename($url), basename($thumb), $url); 4333 4858 4859 /** 4860 * Filter the URL to the attachment thumbnail image. 4861 * 4862 * @since 4863 * 4864 * @param string $url URL of the attachment thumbnail image. 4865 * @param int $post->ID The attachment post ID. 4866 */ 4334 4867 return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID ); 4335 4868 } 4336 4869 … … 4395 4928 $icon_files = wp_cache_get('icon_files'); 4396 4929 4397 4930 if ( !is_array($icon_files) ) { 4398 $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' ); 4399 $icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url('images/crystal') ); 4400 $dirs = apply_filters( 'icon_dirs', array($icon_dir => $icon_dir_uri) ); 4931 $icon_dir = ABSPATH . WPINC . '/images/crystal'; 4932 /** 4933 * Filter the path to the directory containing mime type icons. 4934 * 4935 * @since 4936 * 4937 * @param string $icon_dir Path to the mime type icons directory. 4938 */ 4939 $icon_dir = apply_filters( 'icon_dir', $icon_dir ); 4940 4941 $icon_dir_uri = includes_url( 'images/crystal' ); 4942 /** 4943 * Filter the URI to the directory containing mime type icons. 4944 * 4945 * @since 4946 * 4947 * @param string $icon_dir_uri URI to the mime type icons directory. 4948 */ 4949 $icon_dir_uri = apply_filters( 'icon_dir_uri', $icon_dir_uri ); 4950 4951 $dirs = array( $icon_dir => $icon_dir_uri ) 4952 /** 4953 * Filter the base directories containing mime type icons. 4954 * 4955 * @since 4956 * 4957 * @param array $dirs An array containing the icon directory path as key, icon directory URI as value. 4958 */ 4959 $dirs = apply_filters( 'icon_dirs', $dirs ); 4401 4960 $icon_files = array(); 4402 4961 while ( $dirs ) { 4403 4962 $keys = array_keys( $dirs ); … … 4444 5003 } 4445 5004 } 4446 5005 4447 return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); // Last arg is 0 if function pass mime type. 5006 /** 5007 * Filter the returned icon URL for a mime type. 5008 * 5009 * @since 5010 * 5011 * @param string $icon URL to the mime type icon. 5012 * @param string $mime The mime type. 5013 * @param int $post_id The post ID. 0 if a mime type was passed to the function. 5014 */ 5015 return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); 4448 5016 } 4449 5017 4450 5018 /** … … 4572 5140 * 4573 5141 * @since 0.71 4574 5142 * 4575 * @uses apply_filters() Calls 'get_lastpostdate' filter4576 *4577 5143 * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. 4578 5144 * @return string The date of the last post. 4579 5145 */ 4580 function get_lastpostdate($timezone = 'server') { 4581 return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date' ), $timezone ); 5146 function get_lastpostdate( $timezone = 'server' ) { 5147 $last_post_time = _get_last_post_time( $timezone, 'date' ); 5148 /** 5149 * Filter the date the last post was published. 5150 * 5151 * @since 5152 * 5153 * @param string $last_post_time The post date. 5154 * @param string $timezone The location to the get the time. Can be 'gmt', 'blog', or 'server'. 5155 */ 5156 return apply_filters( 'get_lastpostdate', $last_post_time, $timezone ); 4582 5157 } 4583 5158 4584 5159 /** … … 4589 5164 * 'gmt' is when the last post was modified in GMT time. 4590 5165 * 4591 5166 * @since 1.2.0 4592 * @uses apply_filters() Calls 'get_lastpostmodified' filter4593 5167 * 4594 5168 * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. 4595 5169 * @return string The date the post was last modified. 4596 5170 */ 4597 function get_lastpostmodified( $timezone = 'server') {5171 function get_lastpostmodified( $timezone = 'server' ) { 4598 5172 $lastpostmodified = _get_last_post_time( $timezone, 'modified' ); 4599 5173 4600 5174 $lastpostdate = get_lastpostdate($timezone); 4601 5175 if ( $lastpostdate > $lastpostmodified ) 4602 5176 $lastpostmodified = $lastpostdate; 4603 5177 5178 /** 5179 * Filter the date the last post was modified. 5180 * 5181 * @since 5182 * 5183 * @param string $lastpostmodified The post modified date. 5184 * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. 5185 */ 4604 5186 return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone ); 4605 5187 } 4606 5188 … … 4682 5264 * @subpackage Cache 4683 5265 * @since 2.0.0 4684 5266 * 4685 * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any).4686 *4687 5267 * @param int|object $post Post ID or object to remove from the cache 4688 5268 */ 4689 5269 function clean_post_cache( $post ) { … … 4703 5283 4704 5284 wp_cache_delete( 'wp_get_archives', 'general' ); 4705 5285 5286 /** 5287 * Fires after post and its post meta has been deleted from the cache. 5288 * 5289 * @since 5290 * 5291 * @param int $post->ID The post ID. 5292 * @param WP_Post $post The WP_Post object. 5293 */ 4706 5294 do_action( 'clean_post_cache', $post->ID, $post ); 4707 5295 4708 5296 if ( is_post_type_hierarchical( $post->post_type ) ) … … 4710 5298 4711 5299 if ( 'page' == $post->post_type ) { 4712 5300 wp_cache_delete( 'all_page_ids', 'posts' ); 5301 /** 5302 * Fires after the page cache has been deleted. 5303 * 5304 * @since 5305 * 5306 * @param int $post->ID The page ID. 5307 */ 4713 5308 do_action( 'clean_page_cache', $post->ID ); 4714 5309 } 4715 5310 … … 4797 5392 * @subpackage Cache 4798 5393 * @since 3.0.0 4799 5394 * 4800 * @uses do_action() Calls 'clean_attachment_cache' on $id.4801 *4802 5395 * @param int $id The attachment ID in the cache to clean 4803 5396 * @param bool $clean_terms optional. Whether to clean terms cache 4804 5397 */ … … 4816 5409 if ( $clean_terms ) 4817 5410 clean_object_term_cache($id, 'attachment'); 4818 5411 4819 do_action('clean_attachment_cache', $id); 5412 /** 5413 * Fires after the attachment cache has been cleaned. 5414 * 5415 * @since 5416 * 5417 * @param int $id The attachment ID. 5418 */ 5419 do_action( 'clean_attachment_cache', $id ); 4820 5420 } 4821 5421 4822 5422 // … … 4829 5429 * @since 2.3.0 4830 5430 * @access private 4831 5431 * @uses $wpdb 4832 * @uses do_action() Calls 'private_to_published' on post ID if this is a 'private_to_published' call.4833 5432 * @uses wp_clear_scheduled_hook() with 'publish_future_post' and post ID. 4834 5433 * 4835 5434 * @param string $new_status New post status … … 4843 5442 // Reset GUID if transitioning to publish and it is empty 4844 5443 if ( '' == get_the_guid($post->ID) ) 4845 5444 $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); 4846 do_action('private_to_published', $post->ID); // Deprecated, use private_to_publish 5445 5446 /** 5447 * Fires when transitioning a post from the private to published post status. 5448 * 5449 * @since 5450 * @deprecated Use 'private_to_publish' hook instead. 5451 * 5452 * @param int $post->ID The post ID. 5453 */ 5454 do_action( 'private_to_published', $post->ID ); 4847 5455 } 4848 5456 4849 5457 // If published posts changed clear the lastpostmodified cache … … 4882 5490 * @since 2.3.0 4883 5491 * @access private 4884 5492 * @uses XMLRPC_REQUEST and WP_IMPORTING constants. 4885 * @uses do_action() Calls 'xmlrpc_publish_post' on post ID if XMLRPC_REQUEST is defined.4886 5493 * 4887 5494 * @param int $post_id The ID in the database table of the post being published 4888 5495 */ 4889 5496 function _publish_post_hook($post_id) { 4890 if ( defined('XMLRPC_REQUEST') ) 4891 do_action('xmlrpc_publish_post', $post_id); 5497 if ( defined( 'XMLRPC_REQUEST' ) ) { 5498 /** 5499 * Fires after XMLRPC_REQUEST is defined. 5500 * 5501 * @since 5502 * 5503 * @param int $post_id The post ID. 5504 */ 5505 do_action( 'xmlrpc_publish_post', $post_id ); 5506 } 4892 5507 4893 5508 if ( defined('WP_IMPORTING') ) 4894 5509 return;