Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: preview_post_link

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

This hook occurs 2 times in this file.

Line Code
76  * @todo Document the $messages array(s).
77  */
78 $permalink = get_permalink( $post_ID );
79 if ( ! $permalink ) {
80      $permalink = '';
81 }
82
83 $messages = array();
84 /** This filter is documented in wp-admin/includes/meta-boxes.php */
85 $post_preview_url = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $permalink ), $post );
86
87 $messages['post'] = array(
88       0 => '', // Unused. Messages start at index 1.
89       1 => sprintf( __('Post updated. <a href="%s">View post</a>'), esc_url( $permalink ) ),
90       2 => __('Custom field updated.'),
91       3 => __('Custom field deleted.'),
92       4 => __('Post updated.'),
93      /* translators: %s: date and time of the revision */
94       5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
 
Line Code
96       7 => __('Post saved.'),
97       8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( $post_preview_url ) ),
98       9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'),
99           /* translators: Publish box date format, see http://php.net/date */
100           date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ),
101      10 => sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), esc_url( $post_preview_url ) ),
102 );
103
104 /** This filter is documented in wp-admin/includes/meta-boxes.php */
105 $page_preview_url = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $permalink ), $post );
106
107 $messages['page'] = array(
108       0 => '', // Unused. Messages start at index 1.
109       1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( $permalink ) ),
110       2 => __('Custom field updated.'),
111       3 => __('Custom field deleted.'),
112       4 => __('Page updated.'),
113       5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
114       6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( $permalink ) ),