Skip to content

Commit

Permalink
Make the_content filter a filterable option.
Browse files Browse the repository at this point in the history
This is causing display problems for some users, better to make it optional.
  • Loading branch information
joedolson committed Sep 13, 2024
1 parent 695f0b8 commit f9514b1
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/my-calendar-output.php
Original file line number Diff line number Diff line change
Expand Up @@ -1381,10 +1381,23 @@ function mc_show_event_template( $content ) {
$content = do_shortcode( apply_filters( 'mc_event_post_content', $new_content, $content, $post ) );
}
}
// Execute content filters so that OEmbeds are processed, after removing this filter.
remove_filter( 'the_content', 'mc_show_event_template', 100, 1 );
$content = apply_filters( 'the_content', $content );
add_filter( 'the_content', 'mc_show_event_template', 100, 1 );
/**
* Enable running `the_content` filters on My Calendar output.
* Allows oembed and block articulation, but may cause other problems.
*
* @hook mc_execute_the_content
*
* @param {bool} $execute Whether `the_content` will be run. Default false.
*
* @return {bool}
*/
$execute_the_content = apply_filters( 'mc_execute_the_content', false );
if ( $execute_the_content ) {
// Execute content filters so that OEmbeds are processed, after removing this filter.
remove_filter( 'the_content', 'mc_show_event_template', 100, 1 );
$content = apply_filters( 'the_content', $content );
add_filter( 'the_content', 'mc_show_event_template', 100, 1 );
|

return $content;
}
Expand Down

0 comments on commit f9514b1

Please sign in to comment.