From 2274bd007493bc4cbc39dcac91c28be9bd8c7d3d Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Mon, 27 Feb 2023 08:15:02 +0100 Subject: [PATCH] check if post is password protected --- includes/class-shortcodes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-shortcodes.php b/includes/class-shortcodes.php index da2488a..7289808 100644 --- a/includes/class-shortcodes.php +++ b/includes/class-shortcodes.php @@ -82,7 +82,7 @@ class Shortcodes { public static function excerpt( $atts, $content, $tag ) { $post = get_post(); - if ( ! $post ) { + if ( ! $post || \post_password_required( $post ) ) { return ''; } @@ -185,7 +185,7 @@ class Shortcodes { public static function content( $atts, $content, $tag ) { $post = get_post(); - if ( ! $post ) { + if ( ! $post || \post_password_required( $post ) ) { return ''; }