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
1403                     // Latest content is in autosave
1404                     $nonce = wp_create_nonce( 'post_preview_' . $post->ID );
1405                     $preview_link = add_query_arg( array( 'preview_id' => $post->ID, 'preview_nonce' => $nonce ), $preview_link );
1406                }
1407           } else {
1408                $preview_link = '';
1409           }
1410
1411           /** This filter is documented in wp-admin/includes/meta-boxes.php */
1412           $preview_link = apply_filters( 'preview_post_link', $preview_link );
1413
1414           /**
1415            * Filter whether to allow the post lock to be overridden.
1416            *
1417            * Returning a falsey value to the filter will disable the ability
1418            * to override the post lock.
1419            *
1420            * @since 3.6.0
1421            *
 
Line Code
1605           $query_args['preview_nonce'] = wp_create_nonce( 'post_preview_' . $post->ID );
1606
1607           if ( isset( $_POST['post_format'] ) )
1608                $query_args['post_format'] = empty( $_POST['post_format'] ) ? 'standard' : sanitize_key( $_POST['post_format'] );
1609      }
1610
1611      $url = add_query_arg( $query_args, get_permalink( $post->ID ) );
1612
1613      /** This filter is documented in wp-admin/includes/meta-boxes.php */
1614      return apply_filters( 'preview_post_link', $url );
1615 }
1616
1617 /**
1618  * Save a post submitted with XHR
1619  *
1620  * Intended for use with heartbeat and autosave.js
1621  *
1622  * @since 3.9
1623  *