Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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');  
}
share|improve this answer
    
Thank you very much!!!:) –  dev-jim May 31 '12 at 11:07
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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