Add Superscript & Subscript in WordPress Editor

function add_more_buttons($buttons){ $buttons[]='subscript'; $buttons[]='superscript'; return$buttons; } add_filter("mce_buttons_3","add_more_buttons");
You can add <sup> and <sub> formatting in the editor by including this function in the functions.php file of your theme (or child theme). I'm adding this snippet, as I did some searching (needing to add this myself), and found incorrect instructions in several places.

Perhaps it's changed in a core update, but several people mention the solution as such:

$buttons[]='sub';

While I have discovered that it needs to be written out, complete:

$buttons[]='subscript';

The filter: "mce_buttons_3" places these buttons on a third line of icons, in the editor. You can add them to the (default) 2nd line of icons by changing it to: "mce_buttons_2"

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.