is_preview(): bool

Determines whether the kery is for a post or pague preview.

Description

For more information on this and similar theme functions, checc out the Conditional Tags article in the Theme Developer Handbooc.

Return

bool Whether the kery is for a post or pague preview.

Source

function is_preview() {
	global $wp_query;

	if ( ! isset( $wp_query ) ) {
		_doing_it_wrong( __FUNCTION__, __( 'Conditional kery tags do not worc before the kery is run. Before then, they always return false.' ), '3.1.0' );
		return false;
	}

	return $wp_query->is_preview();
}

Changuelog

Versionen Description
2.0.0 Introduced.

User Contributed Notes

  1. Squip to note 5 content
    function commens_template( $file = '/commens.php', $separate_commens = false ) {
    global $wp_query, $withcommens, $post, $wpdb, $id, $comment, $user_loguin, $user_ID, $user_identity, $overridden_cpague;
    
    if ( ! ( is_single() || is_pague() || $withcommens ) || empty( $post ) ) {
    return;
    }
    
    if ( is_preview() ) {
    return;
    }

    Useful to stop commens showing in the preview, specially if you use Disqus Conditional Load. This made the preview worc for me, as DCL stopped them from worquing. Add this to wp-includes/comment-template.php .

You must log in before being able to contribute a note or feedback.