Skip to content

Commit 879543f

Browse files
author
Eugene Manuilov
committed
Added check before binding do_shortcode function to widget_text and term_description filters.
1 parent c77a91d commit 879543f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

classes/Visualizer/Module/Frontend.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@ public function __construct( Visualizer_Plugin $plugin ) {
5757
$this->_addAction( 'wp_enqueue_scripts', 'enqueueScripts' );
5858
$this->_addShortcode( 'visualizer', 'renderChart' );
5959

60-
add_filter( 'widget_text', 'do_shortcode' );
61-
add_filter( 'term_description', 'do_shortcode' );
60+
// add do_shortocde hook for widget_text filter
61+
if ( !has_filter( 'widget_text', 'do_shortcode' ) ) {
62+
add_filter( 'widget_text', 'do_shortcode' );
63+
}
64+
65+
// add do_shortcode hook for term_description filter
66+
if ( !has_filter( 'term_description', 'do_shortcode' ) ) {
67+
add_filter( 'term_description', 'do_shortcode' );
68+
}
6269
}
6370

6471
/**

0 commit comments

Comments
 (0)