Per user filters
-
I changed the function to show the broken shortcodes to the admin/developer. Around line 70 I changed the function to the following and it appears to be working fine although I don’t know if it’s the proper place for it.
public static function register_filters() { $filters = (array) apply_filters( 'hide_broken_shortcodes_filters', array( 'the_content', 'widget_text', ) ); foreach ( $filters as $filter ) if( !current_user_can('administrator') ) { add_filter( $filter, array( __CLASS__, 'do_shortcode' ), 1001 ); } }
Also is there a bettwer way to do this like a
remove_filter
orremove_action
I could use instead so I don’t have to change the plugin itself? I saw on your faq’s how to remove individual shortcodes, but my goal is to hide the shortcodes for select people. I have a hell of a time trying to understand classes. The codex says you have to do something like this when the plugin is in a class:global $my_class; remove_filter( 'the_content', array($my_class, 'class_filter_function') );
I can’t figure out what to change $myclass and class_filter_function to and maybe I have to add a priority since this gets called late.
https://www.ads-software.com/plugins/hide-broken-shortcodes/
- The topic ‘Per user filters’ is closed to new replies.