From 812e386592f8adec04eabffd828b725c007eb38c Mon Sep 17 00:00:00 2001 From: Ajay DSouza Date: Wed, 21 Sep 2016 23:17:54 +0100 Subject: [PATCH] Don't add code when previewing in Customizer --- includes/tracker.php | 2 +- readme.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/tracker.php b/includes/tracker.php index 9634639..0db7429 100644 --- a/includes/tracker.php +++ b/includes/tracker.php @@ -14,7 +14,7 @@ function tptn_enqueue_scripts() { global $post, $tptn_settings; - if ( is_singular() && 'draft' !== $post->post_status ) { + if ( is_singular() && 'draft' !== $post->post_status && ! is_customize_preview() ) { $current_user = wp_get_current_user(); // Let's get the current user $post_author = ( $current_user->ID === $post->post_author ) ? true : false; // Is the current user the post author? diff --git a/readme.txt b/readme.txt index 174ae8f..61bd2e8 100644 --- a/readme.txt +++ b/readme.txt @@ -175,6 +175,8 @@ add_filter( 'manage_edit-projects_sortable_columns', 'tptn_column_register_sorta * Bug fixes: * Attachments now work with the widget and elsewhere * New tracker now works when jQuery is loaded in the footer + * Don't add tracker code when previewing in customizer + * Doesn't report an error if no author is assigned to a post * Deprecated: * `tptn_add_tracker` and `tptn_add_viewed_count` have been deprecated. These should no longer be needed with the new tracker option.