From ad549f8e2ad66523c4f50e3fce8e2d3aa3c4b39e Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 22 Apr 2025 14:10:44 +1000 Subject: [PATCH] Avoid PHP Warnings when `the_content` filters are run without a $post context. --- modules/post-actions/load.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/post-actions/load.php b/modules/post-actions/load.php index 425ab5a..62f2e45 100644 --- a/modules/post-actions/load.php +++ b/modules/post-actions/load.php @@ -91,7 +91,8 @@ function before_post_likes( $content ) { return $content; } - $actions = apply_filters( 'o2_filter_post_actions', array(), $post->ID ); + $post_id = ! empty( $post->ID ) ? $post->ID : 0; + $actions = apply_filters( 'o2_filter_post_actions', array(), $post_id ); $content .= "