• Resolved DediData

    (@dedidata)


    Hi,
    I have a script which it displays simple editor in frontend (I think it is default tinyMCE)
    But I need to disable link button in the editor to prevent allow users to put any hyperlinks
    And also there is a code tab which it allows users to edit html codes, but I need to disable it too
    any help appreciated
    Thank you

Viewing 1 replies (of 1 total)
  • Thread Starter DediData

    (@dedidata)

    I resolved this issue using these codes:

    add_filter( 'tiny_mce_before_init', 'fb_change_mce_options' );
    add_filter( 'wp_editor_settings', 'my_editor_settings');
    	}
    
    function fb_change_mce_options($initArray) {
            $initArray['relative_urls'] = false;
            $initArray['plugins'] = str_replace(',media','',$initArray['plugins']);
            $initArray['plugins'] = str_replace(',wpeditimage','',$initArray['plugins']);
            $initArray['plugins'] = str_replace(',wpgallery','',$initArray['plugins']);
            $initArray['plugins'] = str_replace(',wplink','',$initArray['plugins']);
            $initArray['plugins'] = str_replace(',image','',$initArray['plugins']);
            $initArray['toolbar1'] = str_replace(',link','',$initArray['toolbar1']);
            
            return $initArray;
    }
    
    function my_editor_settings($settings) {
            if ( ! current_user_can('administrator') ) {
                $settings['quicktags'] = false;
                return $settings;
            } else {
                $settings['quicktags'] = true;
                return $settings;
            }
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Remove specific button(s) from frontend editor’ is closed to new replies.