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
1236           $return .= '‎'; // Fix bi-directional text display defect in RTL languages.
1237           $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";
1238           $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
1239      }
1240
1241      if ( isset( $view_post ) ) {
1242           if( 'draft' == $post->post_status ) {
1243                $preview_link = set_url_scheme( get_permalink( $post->ID ) );
1244                /** This filter is documented in wp-admin/includes/meta-boxes.php */
1245                $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
1246                $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";
1247           } else {
1248                $return .= "<span id='view-post-btn'><a href='" . get_permalink( $post ) . "' class='button button-small'>$view_post</a></span>\n";
1249           }
1250      }
1251
1252      /**
1253       * Filter the sample permalink HTML markup.
1254       *
 
Line Code
1420                     // Latest content is in autosave
1421                     $nonce = wp_create_nonce( 'post_preview_' . $post->ID );
1422                     $preview_link = add_query_arg( array( 'preview_id' => $post->ID, 'preview_nonce' => $nonce ), $preview_link );
1423                }
1424           } else {
1425                $preview_link = '';
1426           }
1427
1428           /** This filter is documented in wp-admin/includes/meta-boxes.php */
1429           $preview_link = apply_filters( 'preview_post_link', $preview_link, $post );
1430
1431           /**
1432            * Filter whether to allow the post lock to be overridden.
1433            *
1434            * Returning a falsey value to the filter will disable the ability
1435            * to override the post lock.
1436            *
1437            * @since 3.6.0
1438            *
 
Line Code
1619           $query_args['preview_nonce'] = wp_create_nonce( 'post_preview_' . $post->ID );
1620
1621           if ( isset( $_POST['post_format'] ) )
1622                $query_args['post_format'] = empty( $_POST['post_format'] ) ? 'standard' : sanitize_key( $_POST['post_format'] );
1623      }
1624
1625      $url = add_query_arg( $query_args, get_permalink( $post->ID ) );
1626
1627      /** This filter is documented in wp-admin/includes/meta-boxes.php */
1628      return apply_filters( 'preview_post_link', $url, $post );
1629 }
1630
1631 /**
1632  * Save a post submitted with XHR
1633  *
1634  * Intended for use with heartbeat and autosave.js
1635  *
1636  * @since 3.9.0
1637  *