Make WordPress Core

Ticket #25376: 25376.diff

File 25376.diff, 42.9 KB (added by DrewAPicture, 12 years ago)

First pass (all hooks)

  • 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
     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
     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
     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
     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
     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
     2023                         *
     2024                         * @param mixed $value   Value of the prefixed post field.
     2025                         * @param int   $post_id The post ID.
     2026                         */
     2027                        $value = apply_filters( "edit_{$field}", $value, $post_id );
     2028                        /**
     2029                         * Filter a prefixed post field prior to being sanitized for the 'edit' context.
     2030                         *
     2031                         * The dynamic portion of the hook name, $field_no_prefix. refers to normally-prefixed
     2032                         * post fields with the 'post_' prefix removed.
     2033                         *
     2034                         * @since
     2035                         *
     2036                         * @param mixed $value   Value of the non-prefixed post field.
     2037                         * @param int   $post_id The post ID.
     2038                         */
     2039                        $value = apply_filters( "{$field_no_prefix}_edit_pre", $value, $post_id );
    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
     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
     2072                         *
     2073                         * @param mixed $value Value of the post field.
     2074                         */
     2075                        $value = apply_filters( "pre_{$field}", $value );
     2076                        /**
     2077                         * Filter the non-prefixed post field prior to being sanitized for the 'db' context.
     2078                         *
     2079                         * The dynamic portion of the hook name, $field_no_prefix. refers to normally-prefixed
     2080                         * post fields with the 'post_' prefix removed.
     2081                         *
     2082                         * @since
     2083                         *
     2084                         * @param mixed $value Value of the post field.
     2085                         */
     2086                        $value = apply_filters( "{$field_no_prefix}_save_pre", $value );
    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
     2095                         *
     2096                         * @param mixed $value Value of the post field.
     2097                         */
     2098                        $value = apply_filters( "pre_post_{$field}", $value );
     2099                        /**
     2100                         * Filter a non-prefixed post field prior to being sanitized for the 'db' context.
     2101                         *
     2102                         * The dynamic portion of the hook name, $field, refers to fields with names
     2103                         * lacking the 'post_' prefix.
     2104                         *
     2105                         * @since
     2106                         *
     2107                         * @param mixed $value Value of the post field.
     2108                         */
     2109                        $value = apply_filters( "{$field}_pre", $value );
    20062110                }
    20072111        } else {
    20082112                // Use display filters by default.
    2009                 if ( $prefixed )
    2010                         $value = apply_filters($field, $value, $post_id, $context);
    2011                 else
     2113                if ( $prefixed ) {
     2114                        /**
     2115                         * Filter a prefixed post field prior to being sanitized for a context other than 'edit' or 'db'.
     2116                         *
     2117                         * @since
     2118                         *
     2119                         * @param string $field   The prefixed post field name.
     2120                         * @param mixed  $value   Value of the post field.
     2121                         * @param int    $post_id The post ID.
     2122                         * @param string $context The context to sanitize the post field in.
     2123                         */
     2124                $value = apply_filters( $field, $value, $post_id, $context );
     2125                } else {
     2126                        /**
     2127                         * Filter a non-prefixed post field prior to being sanitized for a context other than 'edit' or 'db'.
     2128                         *
     2129                         * The dynamic portion of the hook name, $field, refers to fields with names
     2130                         * lacking the 'post_' prefix.
     2131                         *
     2132                         * @since
     2133                         *
     2134                         * @param mixed  $value   Value of the post field.
     2135                         * @param int    $post_id The post ID.
     2136                         * @param string $context The context to sanitize the post field in.
     2137                         */
    20122138                        $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
     2311        /**
     2312         * Filter the default post mime types.
     2313         *
     2314         * @since
     2315         *
     2316         * @param array $post_mime_types An array of post mime types.
     2317         */
    21842318        return apply_filters('post_mime_types', $post_mime_types);
    21852319}
    21862320
     
    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
     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
     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
     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
     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
     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
     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
     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
     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
     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
     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
     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
     2740         *
     2741         * @param int $post_id The post ID.
     2742         */
     2743        do_action( 'untrashed_post_comments', $post_id );
    25272744}
    25282745
    25292746/**
     
    26722889 * @since 1.0.0
    26732890 * @uses $wpdb
    26742891 * @uses $user_ID
    2675  * @uses do_action() Calls 'pre_post_update' on post ID if this is an update.
    2676  * @uses do_action() Calls 'edit_post' action on post ID and post data if this is an update.
    2677  * @uses do_action() Calls 'save_post_{$post_type}', 'save_post' and 'wp_insert_post' on post id and post data just before returning.
    2678  * @uses apply_filters() Calls 'wp_insert_post_data' passing $data, $postarr prior to database update or insert.
    26792892 * @uses wp_transition_post_status()
    26802893 *
    26812894 * @param array $postarr Elements that make up post to insert.
     
    27242937        $maybe_empty = ! $post_content && ! $post_title && ! $post_excerpt && post_type_supports( $post_type, 'editor' )
    27252938                && post_type_supports( $post_type, 'title' ) && post_type_supports( $post_type, 'excerpt' );
    27262939
     2940        /**
     2941         * Filter whether to flag content as empty when inserting or updating a post.
     2942         *
     2943         * $maybe_empty is derived from a mix of conditionals testing if $post_content, $post_title, and $post_excerpt
     2944         * are empty, as well as if the post type supports 'editor', 'title', and 'excerpt.
     2945         *
     2946         * @since
     2947         *
     2948         * @param bool  $maybe_empty Whether content, title, and excerpt are empty.
     2949         * @param array $postarr     An array of post fields passed to wp_insert_post().
     2950         */
    27272951        if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) {
    27282952                if ( $wp_error )
    27292953                        return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) );
     
    28353059        else
    28363060                $post_parent = 0;
    28373061
    2838         // Check the post_parent to see if it will cause a hierarchy loop
     3062        $prepared_postarr = compact( array_keys( $postarr ) );
     3063        /**
     3064         * Filter the post parent ID prior to inserting or updating a post.
     3065         *
     3066         * Allows checking the post_parent for a hierarchy loop.
     3067         *
     3068         * @since
     3069         *
     3070         * @param int   $post_parent      The post parent ID.
     3071         * @param int   $post_ID          The post ID.
     3072         * @param array $prepared_postarr A compacted array of $postarr fields modified from default values.
     3073         * @param array $postarr          An array of post fields sanitized in the 'db' context. @see sanitize_post()
     3074         *
     3075         */
    28393076        $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );
    28403077
    28413078        if ( isset($menu_order) )
     
    28503087
    28513088        // expected_slashed (everything!)
    28523089        $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) );
    2853         $data = apply_filters('wp_insert_post_data', $data, $postarr);
     3090        /**
     3091         * Filter slashed post data to insert in a new or existing post.
     3092         *
     3093         * @since
     3094         *
     3095         * @param array $data    A prepared array of post fields and their values.
     3096         * @param array $postarr An array of post fields sanitized in the 'db' context. @see sanitize_post()
     3097         */
     3098        $data = apply_filters( 'wp_insert_post_data', $data, $postarr );
    28543099        $data = wp_unslash( $data );
    28553100        $where = array( 'ID' => $post_ID );
    28563101
    28573102        if ( $update ) {
     3103                /**
     3104                 * Fires before an existing post is updated.
     3105                 *
     3106                 * @since
     3107                 *
     3108                 * @param int   $post_ID The post ID.
     3109                 * @param array $data    A prepared array of post fields and their values.
     3110                 */
    28583111                do_action( 'pre_post_update', $post_ID, $data );
    28593112                if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
    28603113                        if ( $wp_error )
     
    29313184        wp_transition_post_status($data['post_status'], $previous_status, $post);
    29323185
    29333186        if ( $update ) {
    2934                 do_action('edit_post', $post_ID, $post);
     3187                /**
     3188                 * Fires before a post is updated.
     3189                 *
     3190                 * @since
     3191                 *
     3192                 * @param int     $post_ID The post ID.
     3193                 * @param WP_Post $post    The WP_Post object.
     3194                 */
     3195                do_action( 'edit_post', $post_ID, $post );
    29353196                $post_after = get_post($post_ID);
     3197                /**
     3198                 * Fires after a post is updated.
     3199                 *
     3200                 * @since
     3201                 *
     3202                 * @param int     $post_ID     The post ID.
     3203                 * @param WP_Post $post_after  The WP_Post object after being updated.
     3204                 * @param WP_Post $post_before The WP_Post object before being updated.
     3205                 */
    29363206                do_action( 'post_updated', $post_ID, $post_after, $post_before);
    29373207        }
    29383208
     3209        /**
     3210         * Fires when a post of a particular post type is saved.
     3211         *
     3212         * The dynamic portion of the hook name, $post->post_type, refers to the post type slug.
     3213         *
     3214         * @since
     3215         *
     3216         * @param int     $post_ID The post ID.
     3217         * @param WP_Post $post    The WP_Post object.
     3218         * @param bool    $update  Whether the post is being updated or created. True for updated, false for created.
     3219         */
    29393220        do_action( "save_post_{$post->post_type}", $post_ID, $post, $update );
     3221        /**
     3222         * Fires when a post is saved.
     3223         *
     3224         * @since
     3225         *
     3226         * @param int     $post_ID The post ID.
     3227         * @param WP_Post $post The WP_Post object.
     3228         * @param bool    $update Whether the post is being updated or created. True for updated, false for created.
     3229         */
    29403230        do_action( 'save_post', $post_ID, $post, $update );
     3231        /**
     3232         * Fires when a post is updated or inserted.
     3233         *
     3234         * @since
     3235         *
     3236         * @param int     $post_ID The post ID.
     3237         * @param WP_Post $post The WP_Post object.
     3238         * @param bool    $update Whether the post is being updated or created. True for updated, false for created.
     3239         */
    29413240        do_action( 'wp_insert_post', $post_ID, $post, $update );
    29423241
    29433242        return $post_ID;
     
    30073306 *
    30083307 * @since 2.1.0
    30093308 * @uses $wpdb
    3010  * @uses do_action() Calls 'edit_post', 'save_post_{$post_type}', 'save_post' and 'wp_insert_post' on post_id and post data.
    30113309 *
    30123310 * @param int|object $post Post ID or object.
    30133311 */
     
    30283326        $post->post_status = 'publish';
    30293327        wp_transition_post_status( 'publish', $old_status, $post );
    30303328
     3329        /**
     3330         * Fires after a post has been published and post status changed.
     3331         *
     3332         * @since
     3333         *
     3334         * @param int     $post->ID The post ID.
     3335         * @param WP_Post $post     The WP_Post object.
     3336         */
    30313337        do_action( 'edit_post', $post->ID, $post );
     3338        //duplicate_hook
    30323339        do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
     3340        //duplicate_hook
    30333341        do_action( 'save_post', $post->ID, $post, true );
     3342        //duplicate_hook
    30343343        do_action( 'wp_insert_post', $post->ID, $post, true );
    30353344}
    30363345
     
    30783387 * @param string $post_status no uniqueness checks are made if the post is still draft or pending
    30793388 * @param string $post_type
    30803389 * @param integer $post_parent
    3081  * @return string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
     3390 * @return string Zunique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
    30823391 */
    30833392function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
    30843393        if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) )
     
    30983407                $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
    30993408                $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) );
    31003409
     3410                /**
     3411                 * Filter whether a unique post slug is a bad attachment slug.
     3412                 *
     3413                 * @since
     3414                 *
     3415                 * @param bool   false Whether a unique post slug is flagged as a bad attachment slug. Default false.
     3416                 * @param string $slug The post slug.
     3417                 */
    31013418                if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) {
    31023419                        $suffix = 2;
    31033420                        do {
     
    31153432                $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";
    31163433                $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) );
    31173434
     3435                /**
     3436                 * Filter whether a unique post slug is a bad hierarchical slug.
     3437                 *
     3438                 * @since
     3439                 *
     3440                 * @param bool   false        Whether a unique post slug is flagged as a bad idea for a hierarchical slug. Default false.
     3441                 * @param string $post_type   The post type.
     3442                 * @param int    $post_parent The post parent ID.
     3443                 */
    31183444                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 ) ) {
    31193445                        $suffix = 2;
    31203446                        do {
     
    31293455                $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
    31303456                $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) );
    31313457
     3458                /**
     3459                 * Filter whether a unique post slug is a bad flat slug.
     3460                 *
     3461                 * @since
     3462                 *
     3463                 * @param bool   false      Whether the slug is a bad flat slug.
     3464                 * @param string $slug      The unique post slug.
     3465                 * @param string $post_type The post type.
     3466                 */
    31323467                if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) {
    31333468                        $suffix = 2;
    31343469                        do {
     
    31403475                }
    31413476        }
    31423477
     3478        /**
     3479         * Filter the returned unique post slug.
     3480         *
     3481         * The slug is ased on $post_name (with a -1, -2, etc. suffix).
     3482         *
     3483         * @since
     3484         *
     3485         * @param string $slug          The unique post slug.
     3486         * @param int    $post_ID       The post ID.
     3487         * @param string $post_status   The post status.
     3488         * @param string $post_type     The post type.
     3489         * @param int    $post_parent   The post parent ID.
     3490         * @param string $original_slug The original post slug.
     3491         */
    31433492        return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug );
    31443493}
    31453494
     
    32853634 * @since 2.3.0
    32863635 * @link http://codex.wordpress.org/Post_Status_Transitions
    32873636 *
    3288  * @uses do_action() Calls 'transition_post_status' on $new_status, $old_status and
    3289  *  $post if there is a status change.
    3290  * @uses do_action() Calls '{$old_status}_to_{$new_status}' on $post if there is a status change.
    3291  * @uses do_action() Calls '{$new_status}_{$post->post_type}' on post ID and $post.
    3292  *
    32933637 * @param string $new_status Transition to this post status.
    32943638 * @param string $old_status Previous post status.
    32953639 * @param object $post Post data.
    32963640 */
    32973641function wp_transition_post_status($new_status, $old_status, $post) {
    3298         do_action('transition_post_status', $new_status, $old_status, $post);
    3299         do_action("{$old_status}_to_{$new_status}", $post);
    3300         do_action("{$new_status}_{$post->post_type}", $post->ID, $post);
     3642        /**
     3643         * Fires before a post status has transitioned from one to another
     3644         *
     3645         * @since
     3646         *
     3647         * @param string  $new_status The new post status.
     3648         * @param string  $old_status The old post status.
     3649         * @param WP_Post $post       The WP_Post object.
     3650         */
     3651        do_action( 'transition_post_status', $new_status, $old_status, $post );
     3652        /**
     3653         * Fires before a post status has transitioned from one specific status to another.
     3654         *
     3655         * The dynamic portions of the hook nam, $old_status, and $new_status, refer to the post
     3656         * status the post is changing from and to, respectively. Use this hook for targeting
     3657         * specific post status transitions.
     3658         *
     3659         * @since
     3660         *
     3661         * @param WP_Post $post The WP_Post object.
     3662         */
     3663        do_action( "{$old_status}_to_{$new_status}", $post );
     3664        /**
     3665         * Fires before a post of a particular post type's status has transitioned from one to another.
     3666         *
     3667         * The dynamic portions of the hook name, $new_status, and $post->post_type, refer to the post
     3668         * status the post is transitioning to, and the slug of the post type being updated, respectively.
     3669         * Use this hook for targeting specific new post status changes for a specific post type.
     3670         *
     3671         * @since
     3672         *
     3673         * @param int     $post->ID The post ID.
     3674         * @param WP_Post $post     The WP_Post object.
     3675         */
     3676        do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );
    33013677}
    33023678
    33033679//
     
    33213697        $pung = preg_split('/\s/', $pung);
    33223698        $pung[] = $uri;
    33233699        $new = implode("\n", $pung);
    3324         $new = apply_filters('add_ping', $new);
     3700        /**
     3701         * Filter a ping before it is added to the 'pinged' list in the database.
     3702         *
     3703         * The returned value is expected to be slashed.
     3704         *
     3705         * @since
     3706         *
     3707         * @param string $new The new ping URL to add.
     3708         */
     3709        $new = apply_filters( 'add_ping', $new );
    33253710        // expected_slashed ($new)
    33263711        $new = wp_unslash($new);
    33273712        return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) );
     
    33493734                        $pung[] = trim( $enclosure[ 0 ] );
    33503735                }
    33513736        }
     3737
     3738        /**
     3739         *
     3740         *
     3741         * @since
     3742         *
     3743         * @param string $pung    The pinged URI.
     3744         * @param int    $post_id The post ID.
     3745         */
    33523746        $pung = apply_filters('get_enclosed', $pung, $post_id);
    33533747        return $pung;
    33543748}
     
    33673761        $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id ));
    33683762        $pung = trim($pung);
    33693763        $pung = preg_split('/\s/', $pung);
     3764        /**
     3765         * Filter the URLs already pinged for a post.
     3766         *
     3767         * @since
     3768         *
     3769         * @param string $pung A list of already-pinged URLs for the post.
     3770         */
    33703771        $pung = apply_filters('get_pung', $pung);
    33713772        return $pung;
    33723773}
     
    33853786        $to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id ));
    33863787        $to_ping = sanitize_trackback_urls( $to_ping );
    33873788        $to_ping = preg_split('/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY);
    3388         $to_ping = apply_filters('get_to_ping',  $to_ping);
     3789        /**
     3790         * Filter the URLs that need to be pinged.
     3791         *
     3792         * @since
     3793         *
     3794         * @param string $to_ping A list of URLs still to ping for a post.
     3795         */
     3796        $to_ping = apply_filters( 'get_to_ping',  $to_ping );
    33893797        return $to_ping;
    33903798}
    33913799
     
    37134121        if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {
    37144122                // Convert to WP_Post instances
    37154123                $pages = array_map( 'get_post', $cache );
    3716                 $pages = apply_filters('get_pages', $pages, $r);
     4124                /**
     4125                 * Filter the array of cached page objects to return in get_pages().
     4126                 *
     4127                 * @since
     4128                 *
     4129                 * @param array $pages An array of WP_Post page objects.
     4130                 * @param array $r     An array of arguments for getting pages. @see get_pages()
     4131                 */
     4132                $pages = apply_filters( 'get_pages', $pages, $r );
    37174133                return $pages;
    37184134        }
    37194135
     
    38434259        $pages = $wpdb->get_results($query);
    38444260
    38454261        if ( empty($pages) ) {
    3846                 $pages = apply_filters('get_pages', array(), $r);
     4262                /**
     4263                 * Filter the array of pages returned when no pages are found.
     4264                 *
     4265                 * @since
     4266                 *
     4267                 * @param array    The empty array returned when no pages are found.
     4268                 * @param array $r An array of arguments for getting pages. @see get_pages()
     4269                 */
     4270                $pages = apply_filters( 'get_pages', array(), $r );
    38474271                return $pages;
    38484272        }
    38494273
     
    38824306        // Convert to WP_Post instances
    38834307        $pages = array_map( 'get_post', $pages );
    38844308
    3885         $pages = apply_filters('get_pages', $pages, $r);
     4309        /**
     4310         * Filter the returned array of found pages.
     4311         *
     4312         * @since
     4313         *
     4314         * @param array $pages The array of pages found.
     4315         * @param array $r     An array of arguments for getting pages. @see get_pages()
     4316         */
     4317        $pages = apply_filters( 'get_pages', $pages, $r );
    38864318
    38874319        return $pages;
    38884320}
     
    39454377 * @since 2.0.0
    39464378 * @uses $wpdb
    39474379 * @uses $user_ID
    3948  * @uses do_action() Calls 'edit_attachment' on $post_ID if this is an update.
    3949  * @uses do_action() Calls 'add_attachment' on $post_ID if this is not an update.
    39504380 *
    39514381 * @param string|array $object Arguments to override defaults.
    39524382 * @param string $file Optional filename.
     
    40964526                add_post_meta( $post_ID, '_wp_attachment_context', $context, true );
    40974527
    40984528        if ( $update) {
    4099                 do_action('edit_attachment', $post_ID);
     4529                /**
     4530                 * Fires after an attachment is updated.
     4531                 *
     4532                 * @since
     4533                 *
     4534                 * @param int $post_ID The post ID.
     4535                 */
     4536                do_action( 'edit_attachment', $post_ID );
    41004537        } else {
    4101                 do_action('add_attachment', $post_ID);
     4538                /**
     4539                 * Fires after an attachment is added.
     4540                 *
     4541                 * @since
     4542                 *
     4543                 * @param int $post_ID The post ID.
     4544                 */
     4545                do_action( 'add_attachment', $post_ID );
    41024546        }
    41034547
    41044548        return $post_ID;
     
    41164560 *
    41174561 * @since 2.0.0
    41184562 * @uses $wpdb
    4119  * @uses do_action() Calls 'delete_attachment' hook on Attachment ID.
    41204563 *
    41214564 * @param int $post_id Attachment ID.
    41224565 * @param bool $force_delete Whether to bypass trash and force deletion. Defaults to false.
     
    41504593        if ( is_multisite() )
    41514594                delete_transient( 'dirsize_cache' );
    41524595
    4153         do_action('delete_attachment', $post_id);
     4596        /**
     4597         * Fires after an attachment has been trashed, but before its meta data is deleted.
     4598         *
     4599         * @since
     4600         *
     4601         * @param int $post_id The post ID.
     4602         */
     4603        do_action( 'delete_attachment', $post_id );
    41544604
    41554605        wp_delete_object_term_relationships($post_id, array('category', 'post_tag'));
    41564606        wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type));
     
    41654615        foreach ( $post_meta_ids as $mid )
    41664616                delete_metadata_by_mid( 'post', $mid );
    41674617
     4618        /**
     4619         * Fires after an attachment's meta data has been deleted, but before the attachment is deleted.
     4620         *
     4621         * @since
     4622         *
     4623         * @param int $post_id The post ID.
     4624         */
    41684625        do_action( 'delete_post', $post_id );
    41694626        $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
     4627        /**
     4628         * Fires after an attachment has been deleted.
     4629         *
     4630         * @since
     4631         *
     4632         * @param int $post_id The post ID.
     4633         */
    41704634        do_action( 'deleted_post', $post_id );
    41714635
    41724636        $uploadpath = wp_upload_dir();
     
    41754639                // Don't delete the thumb if another attachment uses it
    41764640                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)) ) {
    41774641                        $thumbfile = str_replace(basename($file), $meta['thumb'], $file);
    4178                         $thumbfile = apply_filters('wp_delete_file', $thumbfile);
     4642                        /**
     4643                         * Filter the path to a thumbnail-sized image being deleted.
     4644                         *
     4645                         * @since
     4646                         *
     4647                         * @param string $thumbfile Path to the thumbnail-sized image to be deleted.
     4648                         */
     4649                        $thumbfile = apply_filters( 'wp_delete_file', $thumbfile );
    41794650                        @ unlink( path_join($uploadpath['basedir'], $thumbfile) );
    41804651                }
    41814652        }
    41824653
    41834654        // remove intermediate and backup images if there are any
    41844655        foreach ( $intermediate_sizes as $intermediate ) {
     4656                /**
     4657                 * Filter the path to a intermediate-sized image being deleted.
     4658                 *
     4659                 * @since
     4660                 *
     4661                 * @param string $intermediate['path'] Path to the intermediate-sized image to be deleted.
     4662                 */
    41854663                $intermediate_file = apply_filters( 'wp_delete_file', $intermediate['path'] );
    41864664                @ unlink( path_join($uploadpath['basedir'], $intermediate_file) );
    41874665        }
     
    41894667        if ( is_array($backup_sizes) ) {
    41904668                foreach ( $backup_sizes as $size ) {
    41914669                        $del_file = path_join( dirname($meta['file']), $size['file'] );
    4192                         $del_file = apply_filters('wp_delete_file', $del_file);
     4670                        /**
     4671                         * Filter the path to an other-sized image being deleted.
     4672                         *
     4673                         * @since
     4674                         *
     4675                         * @param string $del_file Path to the other-sized image to be deleted.
     4676                         */
     4677                        $del_file = apply_filters( 'wp_delete_file', $del_file );
    41934678                        @ unlink( path_join($uploadpath['basedir'], $del_file) );
    41944679                }
    41954680        }
    41964681
    4197         $file = apply_filters('wp_delete_file', $file);
     4682        /**
     4683         * Filter the path to the file to be deleted.
     4684         *
     4685         * @since
     4686         *
     4687         * @param string $file Path to the file.
     4688         */
     4689        $file = apply_filters( 'wp_delete_file', $file );
    41984690
    41994691        if ( ! empty($file) )
    42004692                @ unlink($file);
     
    42234715        if ( $unfiltered )
    42244716                return $data;
    42254717
     4718        /**
     4719         * Filter the returned meta data for an attachment.
     4720         *
     4721         * @since
     4722         *
     4723         * @param array $data     An array of attachment metadata.
     4724         * @param int   $post->ID The attachment post ID.
     4725         */
    42264726        return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID );
    42274727}
    42284728
     
    42404740        if ( !$post = get_post( $post_id ) )
    42414741                return false;
    42424742
     4743        /**
     4744         * Filter the attachment meta data to be updated.
     4745         *
     4746         * @since
     4747         *
     4748         * @param array $data     An array of attachment meta data.
     4749         * @param int   $post->ID The attachment post ID.
     4750         */
    42434751        if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) )
    42444752                return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
    42454753        else
     
    42774785        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.
    42784786                $url = get_the_guid( $post->ID );
    42794787
     4788        /**
     4789         * Filter the attachment URL.
     4790         *
     4791         * @since
     4792         *
     4793         * @param string $url      The URL to the attachment.
     4794         * @param int    $post->ID The attachment post ID.
     4795         */
    42804796        $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
    42814797
    42824798        if ( empty( $url ) )
     
    43024818
    43034819        $file = get_attached_file( $post->ID );
    43044820
    4305         if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) )
     4821        if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) {
     4822                /**
     4823                 * Filter the path to the attachment thumbnail image.
     4824                 *
     4825                 * @since
     4826                 *
     4827                 * @param string $thumbfile Path to the attachment thumbnail image.
     4828                 * @param int    $post->ID  The attachment post ID.
     4829                 */
    43064830                return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
     4831        }
    43074832        return false;
    43084833}
    43094834
     
    43314856
    43324857        $url = str_replace(basename($url), basename($thumb), $url);
    43334858
     4859        /**
     4860         * Filter the URL to the attachment thumbnail image.
     4861         *
     4862         * @since
     4863         *
     4864         * @param string $url      URL of the attachment thumbnail image.
     4865         * @param int    $post->ID The attachment post ID.
     4866         */
    43344867        return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID );
    43354868}
    43364869
     
    43954928                $icon_files = wp_cache_get('icon_files');
    43964929
    43974930                if ( !is_array($icon_files) ) {
    4398                         $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
    4399                         $icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url('images/crystal') );
    4400                         $dirs = apply_filters( 'icon_dirs', array($icon_dir => $icon_dir_uri) );
     4931                        $icon_dir = ABSPATH . WPINC . '/images/crystal';
     4932                        /**
     4933                         * Filter the path to the directory containing mime type icons.
     4934                         *
     4935                         * @since
     4936                         *
     4937                         * @param string $icon_dir Path to the mime type icons directory.
     4938                         */
     4939                        $icon_dir = apply_filters( 'icon_dir', $icon_dir );
     4940
     4941                        $icon_dir_uri = includes_url( 'images/crystal' );
     4942                        /**
     4943                         * Filter the URI to the directory containing mime type icons.
     4944                         *
     4945                         * @since
     4946                         *
     4947                         * @param string $icon_dir_uri URI to the mime type icons directory.
     4948                         */
     4949                        $icon_dir_uri = apply_filters( 'icon_dir_uri', $icon_dir_uri );
     4950
     4951                        $dirs = array( $icon_dir => $icon_dir_uri )
     4952                        /**
     4953                         * Filter the base directories containing mime type icons.
     4954                         *
     4955                         * @since
     4956                         *
     4957                         * @param array $dirs An array containing the icon directory path as key, icon directory URI as value.
     4958                         */
     4959                        $dirs = apply_filters( 'icon_dirs', $dirs );
    44014960                        $icon_files = array();
    44024961                        while ( $dirs ) {
    44034962                                $keys = array_keys( $dirs );
     
    44445003                }
    44455004        }
    44465005
    4447         return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); // Last arg is 0 if function pass mime type.
     5006        /**
     5007         * Filter the returned icon URL for a mime type.
     5008         *
     5009         * @since
     5010         *
     5011         * @param string $icon URL to the mime type icon.
     5012         * @param string $mime The mime type.
     5013         * @param int    $post_id The post ID. 0 if a mime type was passed to the function.
     5014         */
     5015        return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id );
    44485016}
    44495017
    44505018/**
     
    45725140 *
    45735141 * @since 0.71
    45745142 *
    4575  * @uses apply_filters() Calls 'get_lastpostdate' filter
    4576  *
    45775143 * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
    45785144 * @return string The date of the last post.
    45795145 */
    4580 function get_lastpostdate($timezone = 'server') {
    4581         return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date' ), $timezone );
     5146function get_lastpostdate( $timezone = 'server' ) {
     5147        $last_post_time = _get_last_post_time( $timezone, 'date' );
     5148        /**
     5149         * Filter the date the last post was published.
     5150         *
     5151         * @since
     5152         *
     5153         * @param string $last_post_time The post date.
     5154         * @param string $timezone       The location to the get the time. Can be 'gmt', 'blog', or 'server'.
     5155         */
     5156        return apply_filters( 'get_lastpostdate', $last_post_time, $timezone );
    45825157}
    45835158
    45845159/**
     
    45895164 * 'gmt' is when the last post was modified in GMT time.
    45905165 *
    45915166 * @since 1.2.0
    4592  * @uses apply_filters() Calls 'get_lastpostmodified' filter
    45935167 *
    45945168 * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
    45955169 * @return string The date the post was last modified.
    45965170 */
    4597 function get_lastpostmodified($timezone = 'server') {
     5171function get_lastpostmodified( $timezone = 'server' ) {
    45985172        $lastpostmodified = _get_last_post_time( $timezone, 'modified' );
    45995173
    46005174        $lastpostdate = get_lastpostdate($timezone);
    46015175        if ( $lastpostdate > $lastpostmodified )
    46025176                $lastpostmodified = $lastpostdate;
    46035177
     5178        /**
     5179         * Filter the date the last post was modified.
     5180         *
     5181         * @since
     5182         *
     5183         * @param string $lastpostmodified The post modified date.
     5184         * @param string $timezone         The location to get the time. Can be 'gmt', 'blog', or 'server'.
     5185         */
    46045186        return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
    46055187}
    46065188
     
    46825264 * @subpackage Cache
    46835265 * @since 2.0.0
    46845266 *
    4685  * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any).
    4686  *
    46875267 * @param int|object $post Post ID or object to remove from the cache
    46885268 */
    46895269function clean_post_cache( $post ) {
     
    47035283
    47045284        wp_cache_delete( 'wp_get_archives', 'general' );
    47055285
     5286        /**
     5287         * Fires after post and its post meta has been deleted from the cache.
     5288         *
     5289         * @since
     5290         *
     5291         * @param int     $post->ID The post ID.
     5292         * @param WP_Post $post     The WP_Post object.
     5293         */
    47065294        do_action( 'clean_post_cache', $post->ID, $post );
    47075295
    47085296        if ( is_post_type_hierarchical( $post->post_type ) )
     
    47105298
    47115299        if ( 'page' == $post->post_type ) {
    47125300                wp_cache_delete( 'all_page_ids', 'posts' );
     5301                /**
     5302                 * Fires after the page cache has been deleted.
     5303                 *
     5304                 * @since
     5305                 *
     5306                 * @param int $post->ID The page ID.
     5307                 */
    47135308                do_action( 'clean_page_cache', $post->ID );
    47145309        }
    47155310
     
    47975392 * @subpackage Cache
    47985393 * @since 3.0.0
    47995394 *
    4800  * @uses do_action() Calls 'clean_attachment_cache' on $id.
    4801  *
    48025395 * @param int $id The attachment ID in the cache to clean
    48035396 * @param bool $clean_terms optional. Whether to clean terms cache
    48045397 */
     
    48165409        if ( $clean_terms )
    48175410                clean_object_term_cache($id, 'attachment');
    48185411
    4819         do_action('clean_attachment_cache', $id);
     5412        /**
     5413         * Fires after the attachment cache has been cleaned.
     5414         *
     5415         * @since
     5416         *
     5417         * @param int $id The attachment ID.
     5418         */
     5419        do_action( 'clean_attachment_cache', $id );
    48205420}
    48215421
    48225422//
     
    48295429 * @since 2.3.0
    48305430 * @access private
    48315431 * @uses $wpdb
    4832  * @uses do_action() Calls 'private_to_published' on post ID if this is a 'private_to_published' call.
    48335432 * @uses wp_clear_scheduled_hook() with 'publish_future_post' and post ID.
    48345433 *
    48355434 * @param string $new_status New post status
     
    48435442                // Reset GUID if transitioning to publish and it is empty
    48445443                if ( '' == get_the_guid($post->ID) )
    48455444                        $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
    4846                 do_action('private_to_published', $post->ID);  // Deprecated, use private_to_publish
     5445
     5446                /**
     5447                 * Fires when transitioning a post from the private to published post status.
     5448                 *
     5449                 * @since
     5450                 * @deprecated Use 'private_to_publish' hook instead.
     5451                 *
     5452                 * @param int $post->ID The post ID.
     5453                 */
     5454                do_action( 'private_to_published', $post->ID );
    48475455        }
    48485456
    48495457        // If published posts changed clear the lastpostmodified cache
     
    48825490 * @since 2.3.0
    48835491 * @access private
    48845492 * @uses XMLRPC_REQUEST and WP_IMPORTING constants.
    4885  * @uses do_action() Calls 'xmlrpc_publish_post' on post ID if XMLRPC_REQUEST is defined.
    48865493 *
    48875494 * @param int $post_id The ID in the database table of the post being published
    48885495 */
    48895496function _publish_post_hook($post_id) {
    4890         if ( defined('XMLRPC_REQUEST') )
    4891                 do_action('xmlrpc_publish_post', $post_id);
     5497        if ( defined( 'XMLRPC_REQUEST' ) ) {
     5498                /**
     5499                 * Fires after XMLRPC_REQUEST is defined.
     5500                 *
     5501                 * @since
     5502                 *
     5503                 * @param int $post_id The post ID.
     5504                 */
     5505                do_action( 'xmlrpc_publish_post', $post_id );
     5506        }
    48925507
    48935508        if ( defined('WP_IMPORTING') )
    48945509                return;