Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_save_post_revision_check_for_changes

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
150            * This filter can override that so a revision is saved even if nothing has changed.
151            *
152            * @since 3.6.0
153            *
154            * @param bool    $check_for_changes Whether to check for changes before saving a new revision.
155            *                                   Default true.
156            * @param WP_Post $last_revision     The last revision post object.
157            * @param WP_Post $post              The post object.
158            */
159           if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision, $post ) ) {
160                $post_has_changed = false;
161
162                foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) {
163                     if ( normalize_whitespace( $post->$field ) != normalize_whitespace( $last_revision->$field ) ) {
164                          $post_has_changed = true;
165                          break;
166                     }
167                }
168