0

I wonder if there any way to disable/remove the Upload/Insert button on the text editor that created on the custom field? I already has a field that handling the file upload, so I just want the text editor to handle text with basic formatting and lists features.

Thanks

0

You simply set the parameter to false when you create the editor, which you do with a call to the_editor as follows:

<?php the_editor($customcontent, $id = 'CustomContent', $prev_id = 'title', $media_buttons = false, $tab_index = 2); ?>

The first parameter is the content that should be used to fill the editor when the page loads, it may come from a database on an edit page like $row['customcontent'] etc. The second is the id of the textarea, which will also be its name and go through into the $_POST array as the key. Then media_buttons = false is the one that tells it to add no buttons for adding media. Tab index is self explanatory.

You will also need the following to set up the text area:

 add_action('admin_print_scripts','prepare_editor');

function prepare_editor() {
   wp_enqueue_script('post');
    wp_enqueue_script('editor');
        wp_enqueue_script('utils');
        wp_enqueue_script('editor-functions');
        add_action('admin_head','wp_tiny_mce');
       wp_enqueue_script('thickbox');
        wp_admin_css('thickbox');
    wp_enqueue_script('word-count');
        //add_editor_style('style.css');  
}
  • No problems. Glad it helped. Actually, it took me about 3 days to find the perfect way to prepare the editor, as there is a lot of conflicting advice. But that setup there is perfect from 3.0 onwards. – Liam Bailey Jun 2 '12 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.