Make WordPress Core

Changeset 30155


Ignore:
Timestamp:
11/01/2014 08:19:26 PM (10 years ago)
Author:
wonderboymusic
Message:

Improve some post_status-related documentation.

Props ericlewis.
See #30230.

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit.php

    r29989 r30155  
    6363
    6464    if ( 'delete_all' == $doaction ) {
     65        // Prepare for deletion of all posts with a specified post status (i.e. Empty trash).
    6566        $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['post_status']);
    66         if ( get_post_status_object($post_status) ) // Check the post status exists first
     67        // Validate the post status exists.
     68        if ( get_post_status_object( $post_status ) ) {
    6769            $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
     70        }
    6871        $doaction = 'delete';
    6972    } elseif ( isset( $_REQUEST['media'] ) ) {
  • trunk/src/wp-admin/export.php

    r30122 r30155  
    5757);
    5858
     59// If the 'download' URL parameter is set, a WXR export file is baked and returned.
    5960if ( isset( $_GET['download'] ) ) {
    6061    $args = array();
  • trunk/src/wp-admin/includes/ajax-actions.php

    r30141 r30155  
    11431143        if ( isset($_POST['metakeyselect']) && '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) )
    11441144            wp_die( 1 );
     1145       
     1146        // If the post is an autodraft, save the post as a draft and then
     1147        // attempt to save the meta.
    11451148        if ( $post->post_status == 'auto-draft' ) {
    11461149            $save_POST = $_POST; // Backup $_POST
     
    14871490
    14881491/**
    1489  * Ajax handler for quick edit saving for a post.
     1492 * Ajax handler for Quick Edit saving a post from a list table.
    14901493 *
    14911494 * @since 3.1.0
     
    16181621
    16191622/**
    1620  * Ajax handler for finding posts.
     1623 * Ajax handler for querying posts for the Find Posts modal.
     1624 *
     1625 * @see window.findPosts
    16211626 *
    16221627 * @since 3.1.0
     
    21482153
    21492154/**
    2150  * Ajax handler for querying for attachments.
     2155 * Ajax handler for querying attachments.
    21512156 *
    21522157 * @since 3.5.0
     
    21942199
    21952200/**
    2196  * Ajax handler for saving attachment attributes.
     2201 * Ajax handler for updating attachment attributes.
    21972202 *
    21982203 * @since 3.5.0
  • trunk/src/wp-admin/includes/export.php

    r29573 r30155  
    1717
    1818/**
    19  * Generates the WXR export file for download
     19 * Generates the WXR export file for download.
    2020 *
    2121 * @since 2.1.0
    2222 *
    23  * @param array $args Filters defining what should be included in the export
     23 * @param array $args Filters defining what should be included in the export.
    2424 */
    2525function export_wp( $args = array() ) {
  • trunk/src/wp-includes/default-filters.php

    r30074 r30155  
    251251add_action( 'plugins_loaded',             'wp_maybe_load_embeds',                     0    );
    252252add_action( 'shutdown',                   'wp_ob_end_flush_all',                      1    );
     253// Create a revision whenever a post is updated.
    253254add_action( 'post_updated',               'wp_save_post_revision',                   10, 1 );
    254255add_action( 'publish_post',               '_publish_post_hook',                       5, 1 );
  • trunk/src/wp-includes/post.php

    r30122 r30155  
    10611061
    10621062/**
    1063  * Get a list of all registered post status objects.
     1063 * Get a list of post statuses.
    10641064 *
    10651065 * @since 3.0.0
     
    10691069 * @see register_post_status()
    10701070 *
    1071  * @param array|string $args     Optional. Array or string of post status arguments. Default array.
    1072  * @param string       $output   Optional. The type of output to return. Accepts post status 'names'
    1073  *                               or 'objects'. Default 'names'.
     1071 * @param array|string $args     Optional. Array or string of post status arguments to compare against
     1072 *                               properties of the global $wp_post_statuses objects. Default empty array.
     1073 * @param string       $output   Optional. The type of output to return, either 'names' or 'objects'. Default 'names'.
    10741074 * @param string       $operator Optional. The logical operation to perform. 'or' means only one element
    10751075 *                               from the array needs to match; 'and' means all elements must match.
  • trunk/src/wp-includes/revision.php

    r30119 r30155  
    7171
    7272/**
    73  * Saves an already existing post as a post revision.
    74  *
    75  * Typically used immediately after post updates.
    76  * Adds a copy of the current post as a revision, so latest revision always matches current post
    77  *
    78  * @since 2.6.0
    79  *
    80  * @param int $post_id The ID of the post to save as a revision.
     73 * Creates a revision for the current version of a post.
     74 *
     75 * Typically used immediately after a post update, as every update is a revision,
     76 * and the most recent revision always matches the current post.
     77 *
     78 * @since 2.6.0
     79 *
     80 * @param  int  $post_id The ID of the post to save as a revision.
    8181 * @return mixed Null or 0 if error, new revision ID, if success.
    8282 */
     
    157157    $return = _wp_put_post_revision( $post );
    158158
     159    // If a limit for the number of revisions to keep has been set,
     160    // delete the oldest ones.
    159161    $revisions_to_keep = wp_revisions_to_keep( $post );
    160162
     
    162164        return $return;
    163165
    164     // all revisions and autosaves
    165166    $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) );
    166167
     
    447448/**
    448449 * Determine how many revisions to retain for a given post.
    449  * By default, an infinite number of revisions are stored if a post type supports revisions.
     450 *
     451 * By default, an infinite number of revisions are kept.
     452 *
     453 * The constant WP_POST_REVISIONS can be set in wp-config to specify the limit
     454 * of revisions to keep.
    450455 *
    451456 * @since 3.6.0
    452457 *
    453  * @param object $post The post object.
     458 * @param  object $post The post object.
    454459 * @return int The number of revisions to keep.
    455460 */
Note: See TracChangeset for help on using the changeset viewer.