Can you set placeholder text for the TinyMCE textarea generated by wp_editor()?
http://codex.wordpress.org/Function_Reference/wp_editor
My code is currently:
$settings = array( 'media_buttons' => false );
wp_editor( $content, $editor_id, $settings );
This generates a textarea with all the bells and whistles such as TinyMCE buttons and Quicktags but I can't see how I can set placeholder text. With a standard textarea you can do it like so:
<textarea name="content" placeholder="Write something"></textarea>
What follows won't give you an HTML5 "placeholder" attribute for your textarea but it will give you some text to display instead of an empty box:
I think usually you'd use wp_content by passing it all the bits and pieces it needs, like so:
wp_editor( stripslashes($content), $editor_id, $settings );
(The variable $content is a string which may have been obtained from the database or from a $_POST array, etc)
So i suggest that before you call the wp_content() function, test whether $content is empty and if you find that indeed it is, then you could seed it with placeholder content:
if( strlen( stripslashes($content)) == 0) $content = "Write something";
wp_editor( stripslashes($content), $editor_id, $settings );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With