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 3 times in this file.

Line Code
1315           $return .= '‎'; // Fix bi-directional text display defect in RTL languages.
1316           $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __( 'Edit' ) . "</a></span>\n";
1317           $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
1318      }
1319
1320      if ( isset( $view_post ) ) {
1321           if ( 'draft' == $post->post_status ) {
1322                $preview_link = set_url_scheme( get_permalink( $post->ID ) );
1323                /** This filter is documented in wp-admin/includes/meta-boxes.php */
1324                $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
1325                $return .= "<span id='view-post-btn'><a href='" . esc_url( $preview_link ) . "' class='button button-small' target='wp-preview-{$post->ID}'>$view_post</a></span>\n";
1326           } else {
1327                if ( empty( $pretty_permalink ) ) {
1328                     $pretty_permalink = $permalink;
1329                }
1330
1331                $return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>$view_post</a></span>\n";
1332           }
1333      }
 
Line Code
1515                     // Latest content is in autosave
1516                     $nonce = wp_create_nonce( 'post_preview_' . $post->ID );
1517                     $preview_link = add_query_arg( array( 'preview_id' => $post->ID, 'preview_nonce' => $nonce ), $preview_link );
1518                }
1519           } else {
1520                $preview_link = '';
1521           }
1522
1523           /** This filter is documented in wp-admin/includes/meta-boxes.php */
1524           $preview_link = apply_filters( 'preview_post_link', $preview_link, $post );
1525
1526           /**
1527            * Filter whether to allow the post lock to be overridden.
1528            *
1529            * Returning a falsey value to the filter will disable the ability
1530            * to override the post lock.
1531            *
1532            * @since 3.6.0
1533            *
 
Line Code
1714           $query_args['preview_nonce'] = wp_create_nonce( 'post_preview_' . $post->ID );
1715
1716           if ( isset( $_POST['post_format'] ) )
1717                $query_args['post_format'] = empty( $_POST['post_format'] ) ? 'standard' : sanitize_key( $_POST['post_format'] );
1718      }
1719
1720      $url = add_query_arg( $query_args, get_permalink( $post->ID ) );
1721
1722      /** This filter is documented in wp-admin/includes/meta-boxes.php */
1723      return apply_filters( 'preview_post_link', $url, $post );
1724 }
1725
1726 /**
1727  * Save a post submitted with XHR
1728  *
1729  * Intended for use with heartbeat and autosave.js
1730  *
1731  * @since 3.9.0
1732  *