WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
Line | Code |
---|---|
49 | // Add default title if title field is empty |
50 | if ( $compare_from && empty( $compare_from->post_title ) ) |
51 | $compare_from->post_title = __( '(no title)' ); |
52 | if ( empty( $compare_to->post_title ) ) |
53 | $compare_to->post_title = __( '(no title)' ); |
54 |
|
55 | $return = array(); |
56 |
|
57 | foreach ( _wp_post_revision_fields() as $field => $name ) { |
58 | $content_from = $compare_from ? apply_filters( "_wp_post_revision_field_$field", $compare_from->$field, $field, $compare_from, 'from' ) : ''; |
59 | $content_to = apply_filters( "_wp_post_revision_field_$field", $compare_to->$field, $field, $compare_to, 'to' ); |
60 |
|
61 | $diff = wp_text_diff( $content_from, $content_to, array( 'show_split_view' => true ) ); |
62 |
|
63 | if ( ! $diff && 'post_title' === $field ) { |
64 | // It's a better user experience to still show the Title, even if it didn't change. |
65 | // No, you didn't see this. |
66 | $diff = '<table class="diff"><colgroup><col class="content diffsplit left"><col class="content diffsplit middle"><col class="content diffsplit right"></colgroup><tbody><tr>'; |
67 | $diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td><td></td><td>' . esc_html( $compare_to->post_title ) . '</td>'; |
68 | $diff .= '</tr></tbody>'; |