3
votes

Is it possible to change shortcode appearance in Wordpress TinyMCE editor? One of my clients has no HTML knowledge and it's really hard to explain him what not to edit on subpages.

All I want is to hide the shortcodes and add a button on the kitchen sink to show them.

Work arounds. 1 - Filter content before displaying in the editor. Onclick of the button in kitchen sink, call the same url with a $_GET param e.g ?filter=false and do not filter the content this time.

2 - Wrap all shortcodes in a div with a specific class before displaying and toggle that class onclick of the button in the kitchen sink.

For both ways I need to get the content before displaying it in TinyMCE so that I can modify it. Unable to do so .. please help.

P.S: this needs to be done in a plugin. cannot modify core wordpress files.

1
"shortcodes"? "kitchen sink"? You mean, you want to remove some buttons from toolbar? - David Jashi
shortcodes in wordpress, that are used by plugins e.g : [ng-gallary "1"]. Kitchen sink is the advance toolbar in the tinyMCE. - Wasim Qamar

1 Answers

0
votes

You could use the tinymce param "setup" and create a onBeforeSetContent handler. This way you can modify the content before it gegts into the editor and perform Action 2.