Use of the_content filter outside of loop
-
In your code on
mas-static-content/includes/class-mas-static-content-shortcodes.php on line 56
it currently has the followingecho '<div class="mas-static-content' . esc_attr( $class ) . '">' . apply_filters( 'the_content', $post->post_content ) . '</div>';
Can that be updated to simply be
echo '<div class="mas-static-content' . esc_attr( $class ) . '">' . apply_filters( 'widget_block_content', $post->post_content ) . '</div>';
Or you could change how you get the post_content from being to include
the_post();
before you accessthe_content
filter, and then addwp_reset_postdata();
after you output your content to reset the post back to the main query.As any plugin that utilizes the_content filter for its traditional uses inside of the loop will have an unexpected outcome when your plugin is enabled.
Thanks!
- The topic ‘Use of the_content filter outside of loop’ is closed to new replies.