Ticket #25376: 25376.2.diff
File 25376.2.diff, 42.2 KB (added by , 12 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 2.1.0 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 2.1.0 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 2.9.0 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 3.3.0 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 3.5.0 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 2.3.0 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 2.3.0 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 2.3.0 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 2.3.0 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 2.3.0 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 2.3.0 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 2.3.0 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 2012 $value = apply_filters("post_{$field}", $value, $post_id, $context); 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 2.3.0 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 2.3.0 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 */ 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 2184 return apply_filters('post_mime_types', $post_mime_types); 2311 /** 2312 * Filter the default post mime types. 2313 * 2314 * @since 2.5.0 2315 * 2316 * @param array $post_mime_types An array of post mime types. 2317 */ 2318 return apply_filters( 'post_mime_types', $post_mime_types ); 2185 2319 } 2186 2320 2187 2321 /** … … 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 3.2.0 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 1.2.1 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 2.2.0 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 3.2.0 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 3.3.0 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 2.9.0 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 2.9.0 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 2.9.0 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 2.9.0 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 2.9.0 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 2.9.0 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 2.9.0 2740 * 2741 * @param int $post_id The post ID. 2742 */ 2743 do_action( 'untrashed_post_comments', $post_id ); 2527 2744 } 2528 2745 2529 2746 /** … … 2723 2940 $maybe_empty = ! $post_content && ! $post_title && ! $post_excerpt && post_type_supports( $post_type, 'editor' ) 2724 2941 && post_type_supports( $post_type, 'title' ) && post_type_supports( $post_type, 'excerpt' ); 2725 2942 2943 /** 2944 * Filter whether to flag content as empty when inserting or updating a post. 2945 * 2946 * $maybe_empty is derived from a mix of conditionals testing if $post_content, $post_title, and $post_excerpt 2947 * are empty, as well as if the post type supports 'editor', 'title', and 'excerpt. 2948 * 2949 * @since 3.3.0 2950 * 2951 * @param bool $maybe_empty Whether content, title, and excerpt are empty. 2952 * @param array $postarr An array of post fields passed to wp_insert_post(). 2953 */ 2726 2954 if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) { 2727 2955 if ( $wp_error ) 2728 2956 return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) ); … … 2834 3062 else 2835 3063 $post_parent = 0; 2836 3064 2837 // Check the post_parent to see if it will cause a hierarchy loop 3065 $prepared_postarr = compact( array_keys( $postarr ) ); 3066 /** 3067 * Filter the post parent ID prior to inserting or updating a post. 3068 * 3069 * Allows checking the post_parent for a hierarchy loop. 3070 * 3071 * @since 3.1.0 3072 * 3073 * @param int $post_parent The post parent ID. 3074 * @param int $post_ID The post ID. 3075 * @param array $prepared_postarr A compacted array of $postarr fields modified from default values. 3076 * @param array $postarr An array of post fields sanitized in the 'db' context. @see sanitize_post() 3077 * 3078 */ 2838 3079 $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr ); 2839 3080 2840 3081 if ( isset($menu_order) ) … … 2849 3090 2850 3091 // expected_slashed (everything!) 2851 3092 $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' ) ); 2852 $data = apply_filters('wp_insert_post_data', $data, $postarr); 3093 /** 3094 * Filter slashed post data to insert in a new or existing post. 3095 * 3096 * @since 2.7.0 3097 * 3098 * @param array $data A prepared array of post fields and their values. 3099 * @param array $postarr An array of post fields sanitized in the 'db' context. @see sanitize_post() 3100 */ 3101 $data = apply_filters( 'wp_insert_post_data', $data, $postarr ); 2853 3102 $data = wp_unslash( $data ); 2854 3103 $where = array( 'ID' => $post_ID ); 2855 3104 2856 3105 if ( $update ) { 3106 /** 3107 * Fires before an existing post is updated. 3108 * 3109 * @since 2.5.0 3110 * 3111 * @param int $post_ID The post ID. 3112 * @param array $data A prepared array of post fields and their values. 3113 */ 2857 3114 do_action( 'pre_post_update', $post_ID, $data ); 2858 3115 if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { 2859 3116 if ( $wp_error ) … … 2930 3187 wp_transition_post_status($data['post_status'], $previous_status, $post); 2931 3188 2932 3189 if ( $update ) { 2933 do_action('edit_post', $post_ID, $post); 3190 /** 3191 * Fires before a post is updated. 3192 * 3193 * @since 1.2.1 3194 * 3195 * @param int $post_ID The post ID. 3196 * @param WP_Post $post The WP_Post object. 3197 */ 3198 do_action( 'edit_post', $post_ID, $post ); 2934 3199 $post_after = get_post($post_ID); 3200 /** 3201 * Fires after a post is updated. 3202 * 3203 * @since 3.0.0 3204 * 3205 * @param int $post_ID The post ID. 3206 * @param WP_Post $post_after The WP_Post object after being updated. 3207 * @param WP_Post $post_before The WP_Post object before being updated. 3208 */ 2935 3209 do_action( 'post_updated', $post_ID, $post_after, $post_before); 2936 3210 } 2937 3211 3212 /** 3213 * Fires when a post of a particular post type is saved. 3214 * 3215 * The dynamic portion of the hook name, $post->post_type, refers to the post type slug. 3216 * 3217 * @since 3.6.0 3218 * 3219 * @param int $post_ID The post ID. 3220 * @param WP_Post $post The WP_Post object. 3221 * @param bool $update Whether the post is being updated or created. True for updated, false for created. 3222 */ 2938 3223 do_action( "save_post_{$post->post_type}", $post_ID, $post, $update ); 3224 /** 3225 * Fires when a post is saved. 3226 * 3227 * @since 1.5.2 3228 * 3229 * @param int $post_ID The post ID. 3230 * @param WP_Post $post The WP_Post object. 3231 * @param bool $update Whether the post is being updated or created. True for updated, false for created. 3232 */ 2939 3233 do_action( 'save_post', $post_ID, $post, $update ); 3234 /** 3235 * Fires when a post is updated or inserted. 3236 * 3237 * @since 2.0.0 3238 * 3239 * @param int $post_ID The post ID. 3240 * @param WP_Post $post The WP_Post object. 3241 * @param bool $update Whether the post is being updated or created. True for updated, false for created. 3242 */ 2940 3243 do_action( 'wp_insert_post', $post_ID, $post, $update ); 2941 3244 2942 3245 return $post_ID; … … 3006 3309 * 3007 3310 * @since 2.1.0 3008 3311 * @uses $wpdb 3009 * @uses do_action() Calls 'edit_post', 'save_post_{$post_type}', 'save_post' and 'wp_insert_post' on post_id and post data.3010 3312 * 3011 3313 * @param int|object $post Post ID or object. 3012 3314 */ … … 3027 3329 $post->post_status = 'publish'; 3028 3330 wp_transition_post_status( 'publish', $old_status, $post ); 3029 3331 3332 /** 3333 * Fires after a post has been published and post status changed. 3334 * 3335 * @since 1.2.1 3336 * 3337 * @param int $post->ID The post ID. 3338 * @param WP_Post $post The WP_Post object. 3339 */ 3030 3340 do_action( 'edit_post', $post->ID, $post ); 3341 //duplicate_hook 3031 3342 do_action( "save_post_{$post->post_type}", $post->ID, $post, true ); 3343 //duplicate_hook 3032 3344 do_action( 'save_post', $post->ID, $post, true ); 3345 //duplicate_hook 3033 3346 do_action( 'wp_insert_post', $post->ID, $post, true ); 3034 3347 } 3035 3348 … … 3077 3390 * @param string $post_status no uniqueness checks are made if the post is still draft or pending 3078 3391 * @param string $post_type 3079 3392 * @param integer $post_parent 3080 * @return string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)3393 * @return string Zunique slug for the post, based on $post_name (with a -1, -2, etc. suffix) 3081 3394 */ 3082 3395 function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) { 3083 3396 if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) ) … … 3097 3410 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1"; 3098 3411 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) ); 3099 3412 3413 /** 3414 * Filter whether a unique post slug is a bad attachment slug. 3415 * 3416 * @since 3.1.0 3417 * 3418 * @param bool false Whether a unique post slug is flagged as a bad attachment slug. Default false. 3419 * @param string $slug The post slug. 3420 */ 3100 3421 if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) { 3101 3422 $suffix = 2; 3102 3423 do { … … 3114 3435 $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"; 3115 3436 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) ); 3116 3437 3438 /** 3439 * Filter whether a unique post slug is a bad hierarchical slug. 3440 * 3441 * @since 3.1.0 3442 * 3443 * @param bool false Whether a unique post slug is flagged as a bad idea for a hierarchical slug. Default false. 3444 * @param string $post_type The post type. 3445 * @param int $post_parent The post parent ID. 3446 */ 3117 3447 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 ) ) { 3118 3448 $suffix = 2; 3119 3449 do { … … 3128 3458 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; 3129 3459 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); 3130 3460 3461 /** 3462 * Filter whether a unique post slug is a bad flat slug. 3463 * 3464 * @since 3.1.0 3465 * 3466 * @param bool false Whether the slug is a bad flat slug. 3467 * @param string $slug The unique post slug. 3468 * @param string $post_type The post type. 3469 */ 3131 3470 if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) { 3132 3471 $suffix = 2; 3133 3472 do { … … 3139 3478 } 3140 3479 } 3141 3480 3481 /** 3482 * Filter the returned unique post slug. 3483 * 3484 * The slug is ased on $post_name (with a -1, -2, etc. suffix). 3485 * 3486 * @since 3.3.0 3487 * 3488 * @param string $slug The unique post slug. 3489 * @param int $post_ID The post ID. 3490 * @param string $post_status The post status. 3491 * @param string $post_type The post type. 3492 * @param int $post_parent The post parent ID. 3493 * @param string $original_slug The original post slug. 3494 */ 3142 3495 return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ); 3143 3496 } 3144 3497 … … 3284 3637 * @since 2.3.0 3285 3638 * @link http://codex.wordpress.org/Post_Status_Transitions 3286 3639 * 3287 * @uses do_action() Calls 'transition_post_status' on $new_status, $old_status and3288 * $post if there is a status change.3289 * @uses do_action() Calls '{$old_status}_to_{$new_status}' on $post if there is a status change.3290 * @uses do_action() Calls '{$new_status}_{$post->post_type}' on post ID and $post.3291 *3292 3640 * @param string $new_status Transition to this post status. 3293 3641 * @param string $old_status Previous post status. 3294 3642 * @param object $post Post data. 3295 3643 */ 3296 3644 function wp_transition_post_status($new_status, $old_status, $post) { 3297 do_action('transition_post_status', $new_status, $old_status, $post); 3298 do_action("{$old_status}_to_{$new_status}", $post); 3299 do_action("{$new_status}_{$post->post_type}", $post->ID, $post); 3645 /** 3646 * Fires before a post status has transitioned from one to another 3647 * 3648 * @since 2.3.0 3649 * 3650 * @param string $new_status The new post status. 3651 * @param string $old_status The old post status. 3652 * @param WP_Post $post The WP_Post object. 3653 */ 3654 do_action( 'transition_post_status', $new_status, $old_status, $post ); 3655 /** 3656 * Fires before a post status has transitioned from one specific status to another. 3657 * 3658 * The dynamic portions of the hook nam, $old_status, and $new_status, refer to the post 3659 * status the post is changing from and to, respectively. Use this hook for targeting 3660 * specific post status transitions. 3661 * 3662 * @since 2.3.0 3663 * 3664 * @param WP_Post $post The WP_Post object. 3665 */ 3666 do_action( "{$old_status}_to_{$new_status}", $post ); 3667 /** 3668 * Fires before a post of a particular post type's status has transitioned from one to another. 3669 * 3670 * The dynamic portions of the hook name, $new_status, and $post->post_type, refer to the post 3671 * status the post is transitioning to, and the slug of the post type being updated, respectively. 3672 * Use this hook for targeting specific new post status changes for a specific post type. 3673 * 3674 * @since 2.3.0 3675 * 3676 * @param int $post->ID The post ID. 3677 * @param WP_Post $post The WP_Post object. 3678 */ 3679 do_action( "{$new_status}_{$post->post_type}", $post->ID, $post ); 3300 3680 } 3301 3681 3302 3682 // … … 3320 3700 $pung = preg_split('/\s/', $pung); 3321 3701 $pung[] = $uri; 3322 3702 $new = implode("\n", $pung); 3323 $new = apply_filters('add_ping', $new); 3703 /** 3704 * Filter a ping before it is added to the 'pinged' list in the database. 3705 * 3706 * The returned value is expected to be slashed. 3707 * 3708 * @since 2.0.0 3709 * 3710 * @param string $new The new ping URL to add. 3711 */ 3712 $new = apply_filters( 'add_ping', $new ); 3324 3713 // expected_slashed ($new) 3325 3714 $new = wp_unslash($new); 3326 3715 return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) ); … … 3348 3737 $pung[] = trim( $enclosure[ 0 ] ); 3349 3738 } 3350 3739 } 3351 $pung = apply_filters('get_enclosed', $pung, $post_id); 3740 3741 /** 3742 * Filter the array of already-pinged, enclosed URLs. 3743 * 3744 * @since 2.0.0 3745 * 3746 * @param array $pung The pinged URLs. 3747 * @param int $post_id The post ID. 3748 */ 3749 $pung = apply_filters( 'get_enclosed', $pung, $post_id ); 3352 3750 return $pung; 3353 3751 } 3354 3752 … … 3366 3764 $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id )); 3367 3765 $pung = trim($pung); 3368 3766 $pung = preg_split('/\s/', $pung); 3369 $pung = apply_filters('get_pung', $pung); 3767 /** 3768 * Filter the URLs already pinged for a post. 3769 * 3770 * @since 2.0.0 3771 * 3772 * @param string $pung A list of already-pinged URLs for the post. 3773 */ 3774 $pung = apply_filters( 'get_pung', $pung ); 3370 3775 return $pung; 3371 3776 } 3372 3777 … … 3384 3789 $to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id )); 3385 3790 $to_ping = sanitize_trackback_urls( $to_ping ); 3386 3791 $to_ping = preg_split('/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY); 3387 $to_ping = apply_filters('get_to_ping', $to_ping); 3792 /** 3793 * Filter the URLs that need to be pinged. 3794 * 3795 * @since 2.0.0 3796 * 3797 * @param string $to_ping A list of URLs still to ping for a post. 3798 */ 3799 $to_ping = apply_filters( 'get_to_ping', $to_ping ); 3388 3800 return $to_ping; 3389 3801 } 3390 3802 … … 3712 4124 if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) { 3713 4125 // Convert to WP_Post instances 3714 4126 $pages = array_map( 'get_post', $cache ); 3715 $pages = apply_filters('get_pages', $pages, $r); 4127 /** 4128 * Filter the array of cached page objects to return in get_pages(). 4129 * 4130 * @since 2.1.0 4131 * 4132 * @param array $pages An array of WP_Post page objects. 4133 * @param array $r An array of arguments for getting pages. @see get_pages() 4134 */ 4135 $pages = apply_filters( 'get_pages', $pages, $r ); 3716 4136 return $pages; 3717 4137 } 3718 4138 … … 3842 4262 $pages = $wpdb->get_results($query); 3843 4263 3844 4264 if ( empty($pages) ) { 3845 $pages = apply_filters('get_pages', array(), $r); 4265 //duplicate_hook 4266 $pages = apply_filters( 'get_pages', array(), $r ); 3846 4267 return $pages; 3847 4268 } 3848 4269 … … 3880 4301 3881 4302 // Convert to WP_Post instances 3882 4303 $pages = array_map( 'get_post', $pages ); 4304 //duplicate_hook 4305 $pages = apply_filters( 'get_pages', $pages, $r ); 3883 4306 3884 $pages = apply_filters('get_pages', $pages, $r);3885 3886 4307 return $pages; 3887 4308 } 3888 4309 … … 3944 4365 * @since 2.0.0 3945 4366 * @uses $wpdb 3946 4367 * @uses $user_ID 3947 * @uses do_action() Calls 'edit_attachment' on $post_ID if this is an update.3948 * @uses do_action() Calls 'add_attachment' on $post_ID if this is not an update.3949 4368 * 3950 4369 * @param string|array $object Arguments to override defaults. 3951 4370 * @param string $file Optional filename. … … 4095 4514 add_post_meta( $post_ID, '_wp_attachment_context', $context, true ); 4096 4515 4097 4516 if ( $update) { 4098 do_action('edit_attachment', $post_ID); 4517 /** 4518 * Fires after an attachment is updated. 4519 * 4520 * @since 2.0.0 4521 * 4522 * @param int $post_ID The post ID. 4523 */ 4524 do_action( 'edit_attachment', $post_ID ); 4099 4525 } else { 4100 do_action('add_attachment', $post_ID); 4526 /** 4527 * Fires after an attachment is added. 4528 * 4529 * @since 2.0.0 4530 * 4531 * @param int $post_ID The post ID. 4532 */ 4533 do_action( 'add_attachment', $post_ID ); 4101 4534 } 4102 4535 4103 4536 return $post_ID; … … 4115 4548 * 4116 4549 * @since 2.0.0 4117 4550 * @uses $wpdb 4118 * @uses do_action() Calls 'delete_attachment' hook on Attachment ID.4119 4551 * 4120 4552 * @param int $post_id Attachment ID. 4121 4553 * @param bool $force_delete Whether to bypass trash and force deletion. Defaults to false. … … 4149 4581 if ( is_multisite() ) 4150 4582 delete_transient( 'dirsize_cache' ); 4151 4583 4152 do_action('delete_attachment', $post_id); 4584 /** 4585 * Fires after an attachment has been trashed, but before its meta data is deleted. 4586 * 4587 * @since 2.0.0 4588 * 4589 * @param int $post_id The post ID. 4590 */ 4591 do_action( 'delete_attachment', $post_id ); 4153 4592 4154 4593 wp_delete_object_term_relationships($post_id, array('category', 'post_tag')); 4155 4594 wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type)); … … 4164 4603 foreach ( $post_meta_ids as $mid ) 4165 4604 delete_metadata_by_mid( 'post', $mid ); 4166 4605 4606 /** 4607 * Fires after an attachment's meta data has been deleted, but before the attachment is deleted. 4608 * 4609 * @since 1.2.1 4610 * 4611 * @param int $post_id The post ID. 4612 */ 4167 4613 do_action( 'delete_post', $post_id ); 4168 4614 $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) ); 4615 /** 4616 * Fires after an attachment has been deleted. 4617 * 4618 * @since 2.2.0 4619 * 4620 * @param int $post_id The post ID. 4621 */ 4169 4622 do_action( 'deleted_post', $post_id ); 4170 4623 4171 4624 $uploadpath = wp_upload_dir(); … … 4174 4627 // Don't delete the thumb if another attachment uses it 4175 4628 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)) ) { 4176 4629 $thumbfile = str_replace(basename($file), $meta['thumb'], $file); 4177 $thumbfile = apply_filters('wp_delete_file', $thumbfile); 4630 /** 4631 * Filter the path to a specific-sized image being deleted. 4632 * 4633 * This hook fires for all sizes of images. 4634 * 4635 * @since 2.1.0 4636 * 4637 * @param string $thumbfile Path to the thumbnail-sized image to be deleted. 4638 */ 4639 $thumbfile = apply_filters( 'wp_delete_file', $thumbfile ); 4178 4640 @ unlink( path_join($uploadpath['basedir'], $thumbfile) ); 4179 4641 } 4180 4642 } 4181 4643 4182 4644 // remove intermediate and backup images if there are any 4183 4645 foreach ( $intermediate_sizes as $intermediate ) { 4646 //duplicate_hook 4184 4647 $intermediate_file = apply_filters( 'wp_delete_file', $intermediate['path'] ); 4185 4648 @ unlink( path_join($uploadpath['basedir'], $intermediate_file) ); 4186 4649 } … … 4188 4651 if ( is_array($backup_sizes) ) { 4189 4652 foreach ( $backup_sizes as $size ) { 4190 4653 $del_file = path_join( dirname($meta['file']), $size['file'] ); 4191 $del_file = apply_filters('wp_delete_file', $del_file); 4654 //duplicate_hook 4655 $del_file = apply_filters( 'wp_delete_file', $del_file ); 4192 4656 @ unlink( path_join($uploadpath['basedir'], $del_file) ); 4193 4657 } 4194 4658 } 4195 4659 4196 $file = apply_filters('wp_delete_file', $file); 4660 //duplicate_hook 4661 $file = apply_filters( 'wp_delete_file', $file ); 4197 4662 4198 4663 if ( ! empty($file) ) 4199 4664 @ unlink($file); … … 4222 4687 if ( $unfiltered ) 4223 4688 return $data; 4224 4689 4690 /** 4691 * Filter the returned meta data for an attachment. 4692 * 4693 * @since 2.1.0 4694 * 4695 * @param array $data An array of attachment metadata. 4696 * @param int $post->ID The attachment post ID. 4697 */ 4225 4698 return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID ); 4226 4699 } 4227 4700 … … 4239 4712 if ( !$post = get_post( $post_id ) ) 4240 4713 return false; 4241 4714 4715 /** 4716 * Filter the attachment meta data to be updated. 4717 * 4718 * @since 2.1.0 4719 * 4720 * @param array $data An array of attachment meta data. 4721 * @param int $post->ID The attachment post ID. 4722 */ 4242 4723 if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) ) 4243 4724 return update_post_meta( $post->ID, '_wp_attachment_metadata', $data ); 4244 4725 else … … 4276 4757 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. 4277 4758 $url = get_the_guid( $post->ID ); 4278 4759 4760 /** 4761 * Filter the attachment URL. 4762 * 4763 * @since 2.1.0 4764 * 4765 * @param string $url The URL to the attachment. 4766 * @param int $post->ID The attachment post ID. 4767 */ 4279 4768 $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID ); 4280 4769 4281 4770 if ( empty( $url ) ) … … 4301 4790 4302 4791 $file = get_attached_file( $post->ID ); 4303 4792 4304 if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) 4793 if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) { 4794 /** 4795 * Filter the path to the attachment thumbnail image. 4796 * 4797 * @since 2.1.0 4798 * 4799 * @param string $thumbfile Path to the attachment thumbnail image. 4800 * @param int $post->ID The attachment post ID. 4801 */ 4305 4802 return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID ); 4803 } 4306 4804 return false; 4307 4805 } 4308 4806 … … 4330 4828 4331 4829 $url = str_replace(basename($url), basename($thumb), $url); 4332 4830 4831 /** 4832 * Filter the URL to the attachment thumbnail image. 4833 * 4834 * @since 2.1.0 4835 * 4836 * @param string $url URL of the attachment thumbnail image. 4837 * @param int $post->ID The attachment post ID. 4838 */ 4333 4839 return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID ); 4334 4840 } 4335 4841 … … 4394 4900 $icon_files = wp_cache_get('icon_files'); 4395 4901 4396 4902 if ( !is_array($icon_files) ) { 4397 $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' ); 4398 $icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url('images/crystal') ); 4399 $dirs = apply_filters( 'icon_dirs', array($icon_dir => $icon_dir_uri) ); 4903 $icon_dir = ABSPATH . WPINC . '/images/crystal'; 4904 /** 4905 * Filter the path to the directory containing mime type icons. 4906 * 4907 * @since 2.0.0 4908 * 4909 * @param string $icon_dir Path to the mime type icons directory. 4910 */ 4911 $icon_dir = apply_filters( 'icon_dir', $icon_dir ); 4912 4913 $icon_dir_uri = includes_url( 'images/crystal' ); 4914 /** 4915 * Filter the URI to the directory containing mime type icons. 4916 * 4917 * @since 2.0.0 4918 * 4919 * @param string $icon_dir_uri URI to the mime type icons directory. 4920 */ 4921 $icon_dir_uri = apply_filters( 'icon_dir_uri', $icon_dir_uri ); 4922 4923 $dirs = array( $icon_dir => $icon_dir_uri ) 4924 /** 4925 * Filter the base directories containing mime type icons. 4926 * 4927 * @since 2.5.0 4928 * 4929 * @param array $dirs An array containing the icon directory path as key, icon directory URI as value. 4930 */ 4931 $dirs = apply_filters( 'icon_dirs', $dirs ); 4400 4932 $icon_files = array(); 4401 4933 while ( $dirs ) { 4402 4934 $keys = array_keys( $dirs ); … … 4443 4975 } 4444 4976 } 4445 4977 4446 return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); // Last arg is 0 if function pass mime type. 4978 /** 4979 * Filter the returned icon URL for a mime type. 4980 * 4981 * @since 2.1.0 4982 * 4983 * @param string $icon URL to the mime type icon. 4984 * @param string $mime The mime type. 4985 * @param int $post_id The post ID. 0 if a mime type was passed to the function. 4986 */ 4987 return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); 4447 4988 } 4448 4989 4449 4990 /** … … 4571 5112 * 4572 5113 * @since 0.71 4573 5114 * 4574 * @uses apply_filters() Calls 'get_lastpostdate' filter4575 *4576 5115 * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. 4577 5116 * @return string The date of the last post. 4578 5117 */ 4579 function get_lastpostdate($timezone = 'server') { 4580 return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date' ), $timezone ); 5118 function get_lastpostdate( $timezone = 'server' ) { 5119 $last_post_time = _get_last_post_time( $timezone, 'date' ); 5120 /** 5121 * Filter the date the last post was published. 5122 * 5123 * @since 2.3.0 5124 * 5125 * @param string $last_post_time The post date. 5126 * @param string $timezone The location to the get the time. Can be 'gmt', 'blog', or 'server'. 5127 */ 5128 return apply_filters( 'get_lastpostdate', $last_post_time, $timezone ); 4581 5129 } 4582 5130 4583 5131 /** … … 4588 5136 * 'gmt' is when the last post was modified in GMT time. 4589 5137 * 4590 5138 * @since 1.2.0 4591 * @uses apply_filters() Calls 'get_lastpostmodified' filter4592 5139 * 4593 5140 * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. 4594 5141 * @return string The date the post was last modified. 4595 5142 */ 4596 function get_lastpostmodified( $timezone = 'server') {5143 function get_lastpostmodified( $timezone = 'server' ) { 4597 5144 $lastpostmodified = _get_last_post_time( $timezone, 'modified' ); 4598 5145 4599 5146 $lastpostdate = get_lastpostdate($timezone); 4600 5147 if ( $lastpostdate > $lastpostmodified ) 4601 5148 $lastpostmodified = $lastpostdate; 4602 5149 5150 /** 5151 * Filter the date the last post was modified. 5152 * 5153 * @since 2.3.0 5154 * 5155 * @param string $lastpostmodified The post modified date. 5156 * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. 5157 */ 4603 5158 return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone ); 4604 5159 } 4605 5160 … … 4681 5236 * @subpackage Cache 4682 5237 * @since 2.0.0 4683 5238 * 4684 * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any).4685 *4686 5239 * @param int|object $post Post ID or object to remove from the cache 4687 5240 */ 4688 5241 function clean_post_cache( $post ) { … … 4702 5255 4703 5256 wp_cache_delete( 'wp_get_archives', 'general' ); 4704 5257 5258 /** 5259 * Fires after post and its post meta has been deleted from the cache. 5260 * 5261 * @since 2.5.0 5262 * 5263 * @param int $post->ID The post ID. 5264 * @param WP_Post $post The WP_Post object. 5265 */ 4705 5266 do_action( 'clean_post_cache', $post->ID, $post ); 4706 5267 4707 5268 if ( is_post_type_hierarchical( $post->post_type ) ) … … 4709 5270 4710 5271 if ( 'page' == $post->post_type ) { 4711 5272 wp_cache_delete( 'all_page_ids', 'posts' ); 5273 /** 5274 * Fires after the page cache has been deleted. 5275 * 5276 * @since 2.5.0 5277 * 5278 * @param int $post->ID The page ID. 5279 */ 4712 5280 do_action( 'clean_page_cache', $post->ID ); 4713 5281 } 4714 5282 … … 4796 5364 * @subpackage Cache 4797 5365 * @since 3.0.0 4798 5366 * 4799 * @uses do_action() Calls 'clean_attachment_cache' on $id.4800 *4801 5367 * @param int $id The attachment ID in the cache to clean 4802 5368 * @param bool $clean_terms optional. Whether to clean terms cache 4803 5369 */ … … 4815 5381 if ( $clean_terms ) 4816 5382 clean_object_term_cache($id, 'attachment'); 4817 5383 4818 do_action('clean_attachment_cache', $id); 5384 /** 5385 * Fires after the attachment cache has been cleaned. 5386 * 5387 * @since 3.0.0 5388 * 5389 * @param int $id The attachment ID. 5390 */ 5391 do_action( 'clean_attachment_cache', $id ); 4819 5392 } 4820 5393 4821 5394 // … … 4828 5401 * @since 2.3.0 4829 5402 * @access private 4830 5403 * @uses $wpdb 4831 * @uses do_action() Calls 'private_to_published' on post ID if this is a 'private_to_published' call.4832 5404 * @uses wp_clear_scheduled_hook() with 'publish_future_post' and post ID. 4833 5405 * 4834 5406 * @param string $new_status New post status … … 4842 5414 // Reset GUID if transitioning to publish and it is empty 4843 5415 if ( '' == get_the_guid($post->ID) ) 4844 5416 $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); 4845 do_action('private_to_published', $post->ID); // Deprecated, use private_to_publish 5417 5418 /** 5419 * Fires when transitioning a post from the private to published post status. 5420 * 5421 * @since 1.5.2 5422 * @deprecated Use 'private_to_publish' hook instead. 5423 * 5424 * @param int $post->ID The post ID. 5425 */ 5426 do_action( 'private_to_published', $post->ID ); 4846 5427 } 4847 5428 4848 5429 // If published posts changed clear the lastpostmodified cache … … 4881 5462 * @since 2.3.0 4882 5463 * @access private 4883 5464 * @uses XMLRPC_REQUEST and WP_IMPORTING constants. 4884 * @uses do_action() Calls 'xmlrpc_publish_post' on post ID if XMLRPC_REQUEST is defined.4885 5465 * 4886 5466 * @param int $post_id The ID in the database table of the post being published 4887 5467 */ 4888 5468 function _publish_post_hook($post_id) { 4889 if ( defined('XMLRPC_REQUEST') ) 4890 do_action('xmlrpc_publish_post', $post_id); 5469 if ( defined( 'XMLRPC_REQUEST' ) ) { 5470 /** 5471 * Fires after XMLRPC_REQUEST is defined. 5472 * 5473 * @since 2.1.0 5474 * 5475 * @param int $post_id The post ID. 5476 */ 5477 do_action( 'xmlrpc_publish_post', $post_id ); 5478 } 4891 5479 4892 5480 if ( defined('WP_IMPORTING') ) 4893 5481 return;