Home / Admin / How to Customize the Rich Text Field TinyMCE Icons
Duplicate Snippet

Embed Snippet on Your Site

How to Customize the Rich Text Field TinyMCE Icons

<10
Code Preview
php
<?php
/**
 * Customize Rich Text Field TinyMCE buttons for top toolbar.
 *
 * @link https://wpforms.com/developers/how-to-customize-the-rich-text-field-tinymce-icons/
 */
   
// Function to change the top toolbar
function wpf_dev_customize_tinymce_buttons_toolbar1( $toolbar, $field_id, $field_data ) {
  
    $toolbar = [
        'fontselect',
        'fontsizeselect',
        'forecolor',
        'indent',
        'outdent',
        'italic',
        'styleselect',
        'strikethrough',
        'subscript',
        'superscript',
        'underline',
        'charmap',
        'hr',
        'link',
        'wp_more',
        'wp_adv',
    ];
     
    return $toolbar;
}
add_filter( 'wpforms_richtext_get_toolbar1', 'wpf_dev_customize_tinymce_buttons_toolbar1', 10, 3 );
 
/**
 * Customize Rich Text Field TinyMCE buttons for bottom toolbar.
 *
 * @link https://wpforms.com/developers/how-to-customize-the-rich-text-field-tinymce-icons/
 */
   
// Function to change the top toolbar
function wpf_dev_customize_tinymce_buttons_toolbar2( $toolbar, $field_id, $field_data ) {
  
    $toolbar = [
        'wp_help',
        'aligncenter',
        'alignjustify',
        'alignleft',
        'alignnone',
        'alignright',
        'blockquote',
        'backcolor',
        'bold',
        'copy',
        'cut',
        'paste',
        'bullist',
        'numlist',
        'undo',
        'redo',
        'remove',
        'removeformat',
        'selectall',
    ];
     
    return $toolbar;
}
add_filter( 'wpforms_richtext_get_toolbar2', 'wpf_dev_customize_tinymce_buttons_toolbar2', 10, 3 );

Comments

Add a Comment