• JimFitzsimons

    (@jimfitzsimons)


    Hi, forgive me if this has been asked before (an initial search didn’t unearth anything).

    I recently updated to WP3.9 and noticed that the function I use to filter the style/format drop-down in the TinyMCE toolbar no longer works (the default drop-down, not the additional custom styles one).

    I usually put something like this in my functions.php…

    function change_mce_options($init) {
    	$init['theme_advanced_blockformats'] = 'p,h3,h4';
    	return $init;
    }
    add_filter('tiny_mce_before_init', 'change_mce_options');

    And that would ensure that only paragraph, heading 3 and heading 4 got output in the drop-down. Since the update to 3.9 the drop-down displays all default options.

    Any ideas?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    You’ll want to check with TinyMCE4 and see how to filter that.

    http://www.tinymce.com/wiki.php/Tutorial:Migration_guide_from_3.x

    They changed a lot :/

    jberg1

    (@jberg1)

    Try this:

    function change_mce_options($init) {
    	$init['block_formats'] = 'p,h3,h4';
    	return $init;
    }
    add_filter('tiny_mce_before_init', 'change_mce_options');

    They did change a lot
    Look here

    clearscope

    (@clearscope)

    All of my customizations have now stopped working. I tried looking on the tinymce.com website as you suggest, but couldn’t find anything related to what I need. Basically the text colors and text tags.

    Can anyone please help me figure this out, this is really bad that these options have stopped working. Here is the code I have been using that worked perfectly fine up until now:

    function change_mce_options( $init ) {
    $init[‘advanced_blockformats’] = ‘p, h2, h3, h4, h5, h6’;
    $init[‘theme_advanced_disable’] = ‘blockquote,justifyright’;
    $init[‘text_colors’] = ‘000000,353535,6B6B6B,3366FF,FF0000,005728,800000,274368’;
    $init[‘theme_advanced_more_colors’] = true;
    return $init;
    }

    add_filter(‘tiny_mce_before_init’, ‘change_mce_options’);

    Thank you in advance for your help!

    Ok I figured it out in case anyone is interested, this is what I did to get it to work with their new system:

    $in[‘block_formats’] = ‘Paragraph=p;Header 2=h2;Header 3=h3;Header 4=h4;Header 5=h5;Header 6=h6’;
    $custom_colours = ‘
    “000000”, “Black”, “353535”, “Dark Grey”, “6B6B6B”, “Grey”, “3366FF”, “Bright Blue”, “FF0000”, “Red”, “005728”, “Green”, “800000”, “Dark Red”, “274368”, “Dark Blue”
    ‘;
    $in[‘textcolor_map’] = ‘[‘.$custom_colours.’]’;

    return $in;
    }

    add_filter(‘tiny_mce_before_init’, ‘change_mce_options’);

    —-

    Still haven’t found a way to get this one to work and simply disable some of the buttons: $in[‘theme_advanced_disable’] = ‘blockquote,justifyright’;

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP3.9 Filters on TinyMCE 'Format' drop down no longer work’ is closed to new replies.