From f688e79bba81d52ab521ff7e3b5d72f2313b5471 Mon Sep 17 00:00:00 2001 From: Michael Tran Date: Wed, 28 Feb 2024 21:32:02 +1100 Subject: [PATCH] Better check if $post_content exists before use re #165 --- includes/class-toc-plus.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-toc-plus.php b/includes/class-toc-plus.php index 5b61931..6271a07 100644 --- a/includes/class-toc-plus.php +++ b/includes/class-toc-plus.php @@ -1530,7 +1530,7 @@ public function extract_headings( &$find, &$replace, $content = '' ) { public function is_eligible() { global $post; - $custom_toc_position = has_shortcode( $post->post_content, 'toc' ); + $custom_toc_position = isset( $post->post_content ) ? has_shortcode( $post->post_content, 'toc' ) : false; // Do not trigger the TOC on REST Requests unless explicitly enabled. // This ensures that the TOC is not included in REST API responses by default.