Make WordPress Core

Ticket #25376: 25376.2.diff

File 25376.2.diff, 42.2 KB (added by DrewAPicture, 12 years ago)

w/ @since + 'enclosure' clarifications

  • src/wp-includes/post.php

     
    189189                $file = $uploads['basedir'] . "/$file";
    190190        if ( $unfiltered )
    191191                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         */
    192201        return apply_filters( 'get_attached_file', $file, $attachment_id );
    193202}
    194203
     
    199208 * '_wp_attached_file' to store the path of the attachment.
    200209 *
    201210 * @since 2.1.0
    202  * @uses apply_filters() Calls 'update_attached_file' on file path and attachment ID.
    203211 *
    204212 * @param int $attachment_id Attachment ID
    205213 * @param string $file File path for the attachment
     
    209217        if ( !get_post( $attachment_id ) )
    210218                return false;
    211219
     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         */
    212228        $file = apply_filters( 'update_attached_file', $file, $attachment_id );
    213229        if ( $file = _wp_relative_upload_path( $file ) )
    214230                return update_post_meta( $attachment_id, '_wp_attached_file', $file );
     
    222238 * The path is relative to the current upload dir.
    223239 *
    224240 * @since 2.9.0
    225  * @uses apply_filters() Calls '_wp_relative_upload_path' on file path.
    226241 *
    227242 * @param string $path Full path to the file
    228243 * @return string relative path on success, unchanged path on failure.
     
    236251                        $new_path = ltrim( $new_path, '/' );
    237252        }
    238253
     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         */
    239262        return apply_filters( '_wp_relative_upload_path', $new_path, $path );
    240263}
    241264
     
    13311354                register_taxonomy_for_object_type( $taxonomy, $post_type );
    13321355        }
    13331356
     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         */
    13341365        do_action( 'registered_post_type', $post_type, $args );
    13351366
    13361367        return $args;
     
    14971528        $labels = _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );
    14981529
    14991530        $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         */
    15001542        return apply_filters( "post_type_labels_{$post_type}", $labels );
    15011543}
    15021544
     
    19371979 * when calling filters.
    19381980 *
    19391981 * @since 2.3.0
    1940  * @uses apply_filters() Calls 'edit_$field' and '{$field_no_prefix}_edit_pre' passing $value and
    1941  *  $post_id if $context == 'edit' and field name prefix == 'post_'.
    19421982 *
    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 == anything
    1948  *  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  *
    19521983 * @param string $field The Post Object field name.
    19531984 * @param mixed $value The Post Object value.
    19541985 * @param int $post_id Post ID.
     
    19812012                $format_to_edit = array('post_content', 'post_excerpt', 'post_title', 'post_password');
    19822013
    19832014                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 );
    19872040                } 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 );
    19892053                }
    19902054
    19912055                if ( in_array($field, $format_to_edit) ) {
     
    19982062                }
    19992063        } else if ( 'db' == $context ) {
    20002064                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 );
    20032087                } 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 );
    20062110                }
    20072111        } else {
    20082112                // 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                }
    20132140        }
    20142141
    20152142        if ( 'attribute' == $context )
     
    21812308                'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')),
    21822309        );
    21832310
    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 );
    21852319}
    21862320
    21872321/**
     
    22782412 * disabled, item is already in the trash, or $force_delete is true.
    22792413 *
    22802414 * @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'.
    22832415 * @uses wp_delete_attachment() if post type is 'attachment'.
    22842416 * @uses wp_trash_post() if item should be trashed.
    22852417 *
     
    22992431        if ( $post->post_type == 'attachment' )
    23002432                return wp_delete_attachment( $postid, $force_delete );
    23012433
    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 );
    23032444
    23042445        delete_post_meta($postid,'_wp_trash_meta_status');
    23052446        delete_post_meta($postid,'_wp_trash_meta_time');
     
    23482489        foreach ( $post_meta_ids as $mid )
    23492490                delete_metadata_by_mid( 'post', $mid );
    23502491
     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         */
    23512501        do_action( 'delete_post', $postid );
    23522502        $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         */
    23532512        do_action( 'deleted_post', $postid );
    23542513
    23552514        clean_post_cache( $post );
     
    23612520
    23622521        wp_clear_scheduled_hook('publish_future_post', array( $postid ) );
    23632522
    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 );
    23652533
    23662534        return $post;
    23672535}
     
    23722540 * If trash is disabled, the post or page is permanently deleted.
    23732541 *
    23742542 * @since 2.9.0
    2375  * @uses do_action() on 'trash_post' before trashing
    2376  * @uses do_action() on 'trashed_post' after trashing
    23772543 * @uses wp_delete_post() if trash is disabled
    23782544 *
    23792545 * @param int $post_id Post ID.
     
    23892555        if ( $post['post_status'] == 'trash' )
    23902556                return false;
    23912557
    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 );
    23932566
    23942567        add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']);
    23952568        add_post_meta($post_id,'_wp_trash_meta_time', time());
     
    23992572
    24002573        wp_trash_post_comments($post_id);
    24012574
    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 );
    24032583
    24042584        return $post;
    24052585}
     
    24082588 * Restores a post or page from the Trash
    24092589 *
    24102590 * @since 2.9.0
    2411  * @uses do_action() on 'untrash_post' before undeletion
    2412  * @uses do_action() on 'untrashed_post' after undeletion
    24132591 *
    24142592 * @param int $post_id Post ID.
    24152593 * @return mixed False on failure
     
    24212599        if ( $post['post_status'] != 'trash' )
    24222600                return false;
    24232601
    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 );
    24252610
    24262611        $post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
    24272612
     
    24342619
    24352620        wp_untrash_post_comments($post_id);
    24362621
    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 );
    24382630
    24392631        return $post;
    24402632}
     
    24432635 * Moves comments for a post to the trash
    24442636 *
    24452637 * @since 2.9.0
    2446  * @uses do_action() on 'trash_post_comments' before trashing
    2447  * @uses do_action() on 'trashed_post_comments' after trashing
    24482638 *
    24492639 * @param int|object $post Post ID or object.
    24502640 * @return mixed False on failure
     
    24582648
    24592649        $post_id = $post->ID;
    24602650
    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 );
    24622659
    24632660        $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id) );
    24642661        if ( empty($comments) )
     
    24752672
    24762673        clean_comment_cache( array_keys($statuses) );
    24772674
    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 );
    24792684
    24802685        return $result;
    24812686}
     
    24842689 * Restore comments for a post from the trash
    24852690 *
    24862691 * @since 2.9.0
    2487  * @uses do_action() on 'untrash_post_comments' before trashing
    2488  * @uses do_action() on 'untrashed_post_comments' after trashing
    24892692 *
    24902693 * @param int|object $post Post ID or object.
    24912694 * @return mixed False on failure
     
    25042707        if ( empty($statuses) )
    25052708                return true;
    25062709
    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 );
    25082718
    25092719        // Restore each comment to its original status
    25102720        $group_by_status = array();
     
    25232733
    25242734        delete_post_meta($post_id, '_wp_trash_meta_comments_status');
    25252735
    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 );
    25272744}
    25282745
    25292746/**
     
    27232940        $maybe_empty = ! $post_content && ! $post_title && ! $post_excerpt && post_type_supports( $post_type, 'editor' )
    27242941                && post_type_supports( $post_type, 'title' ) && post_type_supports( $post_type, 'excerpt' );
    27252942
     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         */
    27262954        if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) {
    27272955                if ( $wp_error )
    27282956                        return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) );
     
    28343062        else
    28353063                $post_parent = 0;
    28363064
    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         */
    28383079        $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );
    28393080
    28403081        if ( isset($menu_order) )
     
    28493090
    28503091        // expected_slashed (everything!)
    28513092        $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 );
    28533102        $data = wp_unslash( $data );
    28543103        $where = array( 'ID' => $post_ID );
    28553104
    28563105        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                 */
    28573114                do_action( 'pre_post_update', $post_ID, $data );
    28583115                if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
    28593116                        if ( $wp_error )
     
    29303187        wp_transition_post_status($data['post_status'], $previous_status, $post);
    29313188
    29323189        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 );
    29343199                $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                 */
    29353209                do_action( 'post_updated', $post_ID, $post_after, $post_before);
    29363210        }
    29373211
     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         */
    29383223        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         */
    29393233        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         */
    29403243        do_action( 'wp_insert_post', $post_ID, $post, $update );
    29413244
    29423245        return $post_ID;
     
    30063309 *
    30073310 * @since 2.1.0
    30083311 * @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.
    30103312 *
    30113313 * @param int|object $post Post ID or object.
    30123314 */
     
    30273329        $post->post_status = 'publish';
    30283330        wp_transition_post_status( 'publish', $old_status, $post );
    30293331
     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         */
    30303340        do_action( 'edit_post', $post->ID, $post );
     3341        //duplicate_hook
    30313342        do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
     3343        //duplicate_hook
    30323344        do_action( 'save_post', $post->ID, $post, true );
     3345        //duplicate_hook
    30333346        do_action( 'wp_insert_post', $post->ID, $post, true );
    30343347}
    30353348
     
    30773390 * @param string $post_status no uniqueness checks are made if the post is still draft or pending
    30783391 * @param string $post_type
    30793392 * @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)
    30813394 */
    30823395function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
    30833396        if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) )
     
    30973410                $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
    30983411                $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) );
    30993412
     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                 */
    31003421                if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) {
    31013422                        $suffix = 2;
    31023423                        do {
     
    31143435                $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";
    31153436                $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) );
    31163437
     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                 */
    31173447                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 ) ) {
    31183448                        $suffix = 2;
    31193449                        do {
     
    31283458                $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
    31293459                $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) );
    31303460
     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                 */
    31313470                if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) {
    31323471                        $suffix = 2;
    31333472                        do {
     
    31393478                }
    31403479        }
    31413480
     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         */
    31423495        return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug );
    31433496}
    31443497
     
    32843637 * @since 2.3.0
    32853638 * @link http://codex.wordpress.org/Post_Status_Transitions
    32863639 *
    3287  * @uses do_action() Calls 'transition_post_status' on $new_status, $old_status and
    3288  *  $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  *
    32923640 * @param string $new_status Transition to this post status.
    32933641 * @param string $old_status Previous post status.
    32943642 * @param object $post Post data.
    32953643 */
    32963644function 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 );
    33003680}
    33013681
    33023682//
     
    33203700        $pung = preg_split('/\s/', $pung);
    33213701        $pung[] = $uri;
    33223702        $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 );
    33243713        // expected_slashed ($new)
    33253714        $new = wp_unslash($new);
    33263715        return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) );
     
    33483737                        $pung[] = trim( $enclosure[ 0 ] );
    33493738                }
    33503739        }
    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 );
    33523750        return $pung;
    33533751}
    33543752
     
    33663764        $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id ));
    33673765        $pung = trim($pung);
    33683766        $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 );
    33703775        return $pung;
    33713776}
    33723777
     
    33843789        $to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id ));
    33853790        $to_ping = sanitize_trackback_urls( $to_ping );
    33863791        $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 );
    33883800        return $to_ping;
    33893801}
    33903802
     
    37124124        if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {
    37134125                // Convert to WP_Post instances
    37144126                $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 );
    37164136                return $pages;
    37174137        }
    37184138
     
    38424262        $pages = $wpdb->get_results($query);
    38434263
    38444264        if ( empty($pages) ) {
    3845                 $pages = apply_filters('get_pages', array(), $r);
     4265                //duplicate_hook
     4266                $pages = apply_filters( 'get_pages', array(), $r );
    38464267                return $pages;
    38474268        }
    38484269
     
    38804301
    38814302        // Convert to WP_Post instances
    38824303        $pages = array_map( 'get_post', $pages );
     4304        //duplicate_hook
     4305        $pages = apply_filters( 'get_pages', $pages, $r );
    38834306
    3884         $pages = apply_filters('get_pages', $pages, $r);
    3885 
    38864307        return $pages;
    38874308}
    38884309
     
    39444365 * @since 2.0.0
    39454366 * @uses $wpdb
    39464367 * @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.
    39494368 *
    39504369 * @param string|array $object Arguments to override defaults.
    39514370 * @param string $file Optional filename.
     
    40954514                add_post_meta( $post_ID, '_wp_attachment_context', $context, true );
    40964515
    40974516        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 );
    40994525        } 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 );
    41014534        }
    41024535
    41034536        return $post_ID;
     
    41154548 *
    41164549 * @since 2.0.0
    41174550 * @uses $wpdb
    4118  * @uses do_action() Calls 'delete_attachment' hook on Attachment ID.
    41194551 *
    41204552 * @param int $post_id Attachment ID.
    41214553 * @param bool $force_delete Whether to bypass trash and force deletion. Defaults to false.
     
    41494581        if ( is_multisite() )
    41504582                delete_transient( 'dirsize_cache' );
    41514583
    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 );
    41534592
    41544593        wp_delete_object_term_relationships($post_id, array('category', 'post_tag'));
    41554594        wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type));
     
    41644603        foreach ( $post_meta_ids as $mid )
    41654604                delete_metadata_by_mid( 'post', $mid );
    41664605
     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         */
    41674613        do_action( 'delete_post', $post_id );
    41684614        $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         */
    41694622        do_action( 'deleted_post', $post_id );
    41704623
    41714624        $uploadpath = wp_upload_dir();
     
    41744627                // Don't delete the thumb if another attachment uses it
    41754628                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)) ) {
    41764629                        $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 );
    41784640                        @ unlink( path_join($uploadpath['basedir'], $thumbfile) );
    41794641                }
    41804642        }
    41814643
    41824644        // remove intermediate and backup images if there are any
    41834645        foreach ( $intermediate_sizes as $intermediate ) {
     4646                //duplicate_hook
    41844647                $intermediate_file = apply_filters( 'wp_delete_file', $intermediate['path'] );
    41854648                @ unlink( path_join($uploadpath['basedir'], $intermediate_file) );
    41864649        }
     
    41884651        if ( is_array($backup_sizes) ) {
    41894652                foreach ( $backup_sizes as $size ) {
    41904653                        $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 );
    41924656                        @ unlink( path_join($uploadpath['basedir'], $del_file) );
    41934657                }
    41944658        }
    41954659
    4196         $file = apply_filters('wp_delete_file', $file);
     4660        //duplicate_hook
     4661        $file = apply_filters( 'wp_delete_file', $file );
    41974662
    41984663        if ( ! empty($file) )
    41994664                @ unlink($file);
     
    42224687        if ( $unfiltered )
    42234688                return $data;
    42244689
     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         */
    42254698        return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID );
    42264699}
    42274700
     
    42394712        if ( !$post = get_post( $post_id ) )
    42404713                return false;
    42414714
     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         */
    42424723        if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) )
    42434724                return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
    42444725        else
     
    42764757        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.
    42774758                $url = get_the_guid( $post->ID );
    42784759
     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         */
    42794768        $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
    42804769
    42814770        if ( empty( $url ) )
     
    43014790
    43024791        $file = get_attached_file( $post->ID );
    43034792
    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                 */
    43054802                return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
     4803        }
    43064804        return false;
    43074805}
    43084806
     
    43304828
    43314829        $url = str_replace(basename($url), basename($thumb), $url);
    43324830
     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         */
    43334839        return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID );
    43344840}
    43354841
     
    43944900                $icon_files = wp_cache_get('icon_files');
    43954901
    43964902                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 );
    44004932                        $icon_files = array();
    44014933                        while ( $dirs ) {
    44024934                                $keys = array_keys( $dirs );
     
    44434975                }
    44444976        }
    44454977
    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 );
    44474988}
    44484989
    44494990/**
     
    45715112 *
    45725113 * @since 0.71
    45735114 *
    4574  * @uses apply_filters() Calls 'get_lastpostdate' filter
    4575  *
    45765115 * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
    45775116 * @return string The date of the last post.
    45785117 */
    4579 function get_lastpostdate($timezone = 'server') {
    4580         return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date' ), $timezone );
     5118function 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 );
    45815129}
    45825130
    45835131/**
     
    45885136 * 'gmt' is when the last post was modified in GMT time.
    45895137 *
    45905138 * @since 1.2.0
    4591  * @uses apply_filters() Calls 'get_lastpostmodified' filter
    45925139 *
    45935140 * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
    45945141 * @return string The date the post was last modified.
    45955142 */
    4596 function get_lastpostmodified($timezone = 'server') {
     5143function get_lastpostmodified( $timezone = 'server' ) {
    45975144        $lastpostmodified = _get_last_post_time( $timezone, 'modified' );
    45985145
    45995146        $lastpostdate = get_lastpostdate($timezone);
    46005147        if ( $lastpostdate > $lastpostmodified )
    46015148                $lastpostmodified = $lastpostdate;
    46025149
     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         */
    46035158        return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
    46045159}
    46055160
     
    46815236 * @subpackage Cache
    46825237 * @since 2.0.0
    46835238 *
    4684  * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any).
    4685  *
    46865239 * @param int|object $post Post ID or object to remove from the cache
    46875240 */
    46885241function clean_post_cache( $post ) {
     
    47025255
    47035256        wp_cache_delete( 'wp_get_archives', 'general' );
    47045257
     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         */
    47055266        do_action( 'clean_post_cache', $post->ID, $post );
    47065267
    47075268        if ( is_post_type_hierarchical( $post->post_type ) )
     
    47095270
    47105271        if ( 'page' == $post->post_type ) {
    47115272                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                 */
    47125280                do_action( 'clean_page_cache', $post->ID );
    47135281        }
    47145282
     
    47965364 * @subpackage Cache
    47975365 * @since 3.0.0
    47985366 *
    4799  * @uses do_action() Calls 'clean_attachment_cache' on $id.
    4800  *
    48015367 * @param int $id The attachment ID in the cache to clean
    48025368 * @param bool $clean_terms optional. Whether to clean terms cache
    48035369 */
     
    48155381        if ( $clean_terms )
    48165382                clean_object_term_cache($id, 'attachment');
    48175383
    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 );
    48195392}
    48205393
    48215394//
     
    48285401 * @since 2.3.0
    48295402 * @access private
    48305403 * @uses $wpdb
    4831  * @uses do_action() Calls 'private_to_published' on post ID if this is a 'private_to_published' call.
    48325404 * @uses wp_clear_scheduled_hook() with 'publish_future_post' and post ID.
    48335405 *
    48345406 * @param string $new_status New post status
     
    48425414                // Reset GUID if transitioning to publish and it is empty
    48435415                if ( '' == get_the_guid($post->ID) )
    48445416                        $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 );
    48465427        }
    48475428
    48485429        // If published posts changed clear the lastpostmodified cache
     
    48815462 * @since 2.3.0
    48825463 * @access private
    48835464 * @uses XMLRPC_REQUEST and WP_IMPORTING constants.
    4884  * @uses do_action() Calls 'xmlrpc_publish_post' on post ID if XMLRPC_REQUEST is defined.
    48855465 *
    48865466 * @param int $post_id The ID in the database table of the post being published
    48875467 */
    48885468function _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        }
    48915479
    48925480        if ( defined('WP_IMPORTING') )
    48935481                return;