[wp-hackers] WordPress Front-End tinyMCE

Mike Schinkel mikeschinkel at newclarity.net
Thu Jul 7 16:41:40 UTC 2011

On Jul 7, 2011, at 12:23 PM, Scott Kingsley Clark wrote:
>> Has anyone tackled this problem before?
> Actually, I've got just the thing!
> http://plugins.trac.wordpress.org/browser/pods/trunk/ui/wp-editor
> Andrew Ozz developed this as the new API for TinyMCE which allows for
> front / back end forms and much more functionality beyond the current
> mess (you already know what I'm talking about). Goodbye the_editor,
> hello wp_editor!
> We modified the CSS location in the script, so you'll want to pop it
> out and update the location to wherever you end up putting it.
> To use use the editor, you can do this:
> <textarea name="whatever" id="whatever" class="whatever"><?php echo
> esc_html($content); ?></textarea>
> <?php
> global $wp_editor;
> $media_bar = false; // set to true to show the media bar
> echo $wp_editor->editor($content, 'whatever', $media_bar);
> ?>

This is very cool, and probably something I can use for a plugin that we'll be releasing that I am working on right now!

A couple comments and questions. 

1.) I think your example code is wrong, here's the calling signature from the code from from the link you shared:

function editor( $content, $editor_id, $settings = array(), $media_buttons = true ) 

2.) Any reason the $media_buttons is a forth parameter and not just something to pass in via the 3rd $settings parameter?

3.) Why name it wp_editor? Isn't it best practice to let WordPress itself reserve names prefixed with 'wp_'? I see that it was written for WP3.3 (or a future version); is it actually going into WP3.3 as is, or wouldn't it be better to call it pods_editor?

4.) I notice on line 26 the PODS_URL constant is hard-coded. Since it's named wp_editor that seems like it's intended to be a (semi-)defacto standard extension?  Wouldn't it be better to have that default to (something like) dirname(__FILE__) and/or get_option('wp_editor_path')?

5.) Clearly it is GPL licensed, right?  If I wanted to take it, make these mods and then include in my own plugin what would I need to do be follow the GPL license? (Sorry, if this last question is a bit off topic.)

Once again, it's a really nice extension and thanks for sharing.


More information about the wp-hackers mailing list