Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
Better check if $post_content exists before use
Browse files Browse the repository at this point in the history
re #165
  • Loading branch information
zedzedzed committed Feb 28, 2024
1 parent 13721f9 commit f688e79
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion includes/class-toc-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f688e79

Please sign in to comment.