Ticket #26979: 26979.diff
| File 26979.diff, 2.4 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/revision.php
33 33 'post_excerpt' => __( 'Excerpt' ), 34 34 ); 35 35 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 */ 37 54 $fields = apply_filters( '_wp_post_revision_fields', $fields ); 38 55 39 56 // WP uses these internally either in versioning or elsewhere - they cannot be versioned … … 99 116 } 100 117 } 101 118 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 */ 102 133 if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision, $post ) ) { 103 134 $post_has_changed = false; 104 135 … … 422 453 if ( ! post_type_supports( $post->post_type, 'revisions' ) ) 423 454 $num = 0; 424 455 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 */ 425 469 return (int) apply_filters( 'wp_revisions_to_keep', $num, $post ); 426 470 } 427 471