• Resolved indrabhusanroy

    (@indrabhusanroy)


    Is there way to hide “Insert snippets source” Button from wordpress content editor and Tutor Lms mce editor–Basically from every content editor.

    Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @indrabhusanroy,

    Try activating this code snippet in your site to hide the plugin tools from the TinyMCE editor:

    /**
     * Code Snippets:
     * Remove the plugin tools from the TinyMCE editor
     */ 
    remove_class_hook( 'init', 'Code_Snippets\Frontend', 'setup_mce_plugin' );
    
    /**
     * Helper function for accessing action hooks added by methods within a class
     */
    function remove_class_hook( $tag, $class_name = '', $method_name = '', $priority = 10 ) {
    	global $wp_filter;
    	$is_hook_removed = false;
    	if ( ! empty( $wp_filter[ $tag ]->callbacks[ $priority ] ) ) {
    		$methods = array_filter(wp_list_pluck(
    			$wp_filter[ $tag ]->callbacks[ $priority ],
    			'function'
    		), function ($method) {
    			return is_string($method) || is_array($method);
    		});
    		$found_hooks = ! empty( $methods ) ? wp_list_filter( $methods, array( 1 => $method_name ) ) : array();
    		foreach( $found_hooks as $hook_key => $hook ) {
    			if ( ! empty( $hook[0] ) && is_object( $hook[0] ) && get_class( $hook[0] ) === $class_name ) {
    				$wp_filter[ $tag ]->remove_filter( $tag, $hook, $priority );
    				$is_hook_removed = true;
    			}
    		}
    	}
    	return $is_hook_removed;
    }
    
    Plugin Author Shea Bunge

    (@bungeshea)

    @indrabhusanroy can I clarify whether you are using the WordPress Classic Editor, or the new Gutenberg-powered Block Editor?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Hide “Insert snippets source” Button from Content Editor’ is closed to new replies.