1

I have a wordpress site that uses both standard posts and custom posts.

I have no problem removing buttons from the WP editor when it's related to a custom post type. I just add this below to the CPT plugin and reference the textarea I'm using:

$content = get_post_meta($post->ID, 'mytextarea', true);
$args = array(
    'description_name' => 'mytextarea',
    'teeny' => true,
    'quicktags' => false,
    'media_buttons' => false,
    'tinymce' => array(
         'toolbar1'=> 'bold,italic,underline,link,unlink,spellchecker',
         'toolbar2' => '',
         'toolbar3' => ''
    )
);
wp_editor( $content, 'mytextarea', $args );

So, I assume that, in order to do the same but this time for the edit post page, I have to go to the functions.php and do something similar. But I don't know what to type instead of the 'mytextarea' reference. I've looked for the html to find it out but whatever I try, it doesn't affect the wp editor on the edit post page. At best, it creates a new editor on top of it as this code creates a brand new editor before it customizes it.

So how can I target the already existing editor of the edit post page specifically in order to customize the buttons?

I tried many instances of hooks I found on the internet and over here but, for whatever reason, none worked so far. The editor remains stubbornly the same.

Any help would be appreciated.

Thanks.

1

1 Answer 1

1

you can custom the editor with the filter tiny_mce_before_init

e.g. try this code

add_filter("tiny_mce_before_init", function ($initArray, $editor_id) {

    $initArray["toolbar1"] = "bold,italic,underline,link,unlink,spellchecker";
    $initArray["toolbar2"] = "";


    return $initArray;

}, 10, 2);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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