From dd8eb1480dc688eb030a0d43cc692d885ea8ffcf Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 16 Jan 2017 21:19:47 -0800 Subject: [PATCH] Add post_type_exists() check in Edit_Post_Preview::get_preview_post_link() to prevent warning in starter content for CPTs --- php/class-edit-post-preview.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/class-edit-post-preview.php b/php/class-edit-post-preview.php index 23288bc..dc955d1 100644 --- a/php/class-edit-post-preview.php +++ b/php/class-edit-post-preview.php @@ -104,7 +104,7 @@ public function get_previewed_post() { public static function get_preview_post_link( $post ) { $permalink = ''; - if ( $post instanceof WP_Post ) { + if ( $post instanceof WP_Post && post_type_exists( $post->post_type ) ) { $id_param = ( 'page' === $post->post_type ) ? 'page_id' : 'p'; $args = array(); $args['preview'] = true;