Make WordPress Core

Ticket #26979: 26979.diff

File 26979.diff, 2.4 KB (added by adamsilverstein, 12 years ago)
  • src/wp-includes/revision.php

     
    3333                        'post_excerpt' => __( 'Excerpt' ),
    3434                );
    3535
    36                 // Runs only once
     36                /**
     37                 * Filter the list of fields saved in post revisions.
     38                 *
     39                 * Included by default: 'post_title', 'post_content' and 'post_excerpt'.
     40                 *
     41                 * Dissalowed: 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type',
     42                 *     'comment_count' and 'post_author'.
     43                 *
     44                 * @since  2.5.1
     45                 *
     46                 * @param array $fields{
     47                 *     List of fields to revision.
     48                 *
     49                 *     @type String field      The field to revision.
     50                 *     @type String field_name The name of the field.
     51                 * }
     52                 *
     53                 */
    3754                $fields = apply_filters( '_wp_post_revision_fields', $fields );
    3855
    3956                // WP uses these internally either in versioning or elsewhere - they cannot be versioned
     
    99116                        }
    100117                }
    101118
     119                /**
     120                 * Override check for chages in revisioned fields before saving a new revision.
     121                 *
     122                 * By default a revision is saved only if one of the revisioned fields has changed.
     123                 * This filter can override that so a revision is saved even if nothing has changed.
     124                 *
     125                 * @since  3.6.0
     126                 *
     127                 * @param boolean            Check for changes before saving revision? Default true.
     128                 *                           Return false to bypass and save a new revision.
     129                 * @param int $last_revision The id of the last revision.
     130                 * @param int $post          The id of the post being saved as a revision.
     131                 *
     132                 */
    102133                if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision, $post ) ) {
    103134                        $post_has_changed = false;
    104135
     
    422453        if ( ! post_type_supports( $post->post_type, 'revisions' ) )
    423454                $num = 0;
    424455
     456        /**
     457         * Filter the number of revisions to save.
     458         *
     459         * Allows setting the number of revisions to save, overriding the default behaviour of saving
     460         * an unlimited number of revsions. Overrides WP_POST_REVISIONS setting from wp-config.php (if any).
     461         *
     462         * @since  3.6.0
     463         *
     464         * @param int    $num  The number of revisions the store, overrides WP_POST_REVISIONS value.
     465         *                     Older revisions are discarded when a new revision is added.
     466         * @param object $post The post object.
     467         *
     468         */
    425469        return (int) apply_filters( 'wp_revisions_to_keep', $num, $post );
    426470}
    427471