From f8276409ab56ba737ebaf663f17dbdad749f3759 Mon Sep 17 00:00:00 2001 From: Sebastian Thulin Date: Mon, 22 Sep 2025 08:45:50 +0200 Subject: [PATCH] fix: Argument #1 ($post) must be of type WP_Post|int|null, string given --- source/php/Module.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/php/Module.php b/source/php/Module.php index ce11d1ce1..1b4fe8956 100644 --- a/source/php/Module.php +++ b/source/php/Module.php @@ -537,6 +537,11 @@ private function getWidgetNames($widget): array|false { */ public function getShortcodeModules($post_id): array { + if(is_numeric($post_id) === false || $post_id <= 0) { + return []; + } + + $post_id = intval($post_id); $post = WpService::get()->getPost($post_id); $pattern = WpService::get()->getShortcodeRegex(); $modules = array();