Disable the_content hook
-
Hello. Please tell me how to turn off the filter ‘the_content’ via theme’s functions.php?
class StructuredContent_Shortcodes { ... private function __construct() { $this->_version = STRUCTURED_CONTENT_VERSION; $this->_slug = 'structured-content'; $this->_url = untrailingslashit( plugins_url( '/', dirname( __FILE__ ) ) ); add_shortcode( 'sc_fs_faq', array( $this, 'faq' ) ); add_shortcode( 'sc_fs_multi_faq', array( $this, 'multi_faq' ) ); add_shortcode( 'sc_fs_job', array( $this, 'job' ) ); add_shortcode( 'sc_fs_event', array( $this, 'event' ) ); add_shortcode( 'sc_fs_person', array( $this, 'person' ) ); add_shortcode( 'sc_fs_course', array( $this, 'course' ) ); add_shortcode( 'sc_fs_local_business', array( $this, 'local_business' ) ); add_filter( 'the_content', array( $this, 'fix_shortcodes' ) ); add_filter( 'category_description', array( $this, 'fix_shortcodes' ) ); } ... public static function register() { if ( null === self::$instance ) { self::$instance = new StructuredContent_Shortcodes(); } } ... public function fix_shortcodes( $content ) { $array = array( '<p>[' => '[', ']</p>' => ']', ']<br />' => ']', ); $content = strtr( $content, $array ); return $content; } ... } StructuredContent_Shortcodes::register();
Sometimes my content starts with <p>[my_custom_shortcode] … and the plugin cuts out the paragraph tag etc.
- The topic ‘Disable the_content hook’ is closed to new replies.