I want to add a placeholder to the WordPress Editor content box.

When you create a new post, the title field shows "Enter Title Here" exactly same like editor. I have used a filter to add text in the editor, but the behaviour of the filter is not the same as the title field. When I click on title field, "Enter Title Here" is replaced with a blank space.


add_filter( 'default_content', 'my_editor_content' );

function my_editor_content( $content ) {
    $content .= '<b id="enter_desc_here" style="color: #BBBBBB;font-size: 1.7em;">Enter Description Here</b>';
    return $content;

Is it possible to use similar code to add a place holder to the Editor's Content box?

  • "i click on title field then "enter title here" is replace to blank space" what else do u expect from a placeholder ? Commented Aug 27, 2013 at 9:53
  • But i want add for editor.. Commented Aug 27, 2013 at 9:55

1 Answer 1


I handled this by creating a utility function that takes a new placeholder and the post type, then uses a filter to add a placeholder attribute to the <textarea>. This will be able similar to the Title field, which I think is what you are trying to accomplish.

 * Change the default placeholder for the post editor
 * @param string    $new_placeholder    Placeholder text to add to editor field
 * @param string    $post_type          Post_type where placeholder text should be used.
function change_editor_placeholder ( $new_placeholder, $post_type ){
    $change_func = function( $html ) use ( $new_placeholder, $post_type ) {
        $screen = get_current_screen();
        if ( $post_type == $screen->post_type ){
            $html = preg_replace('/<textarea/', '<textarea placeholder="' . $new_placeholder . '" ', $html);
        return $html;
    add_filter('the_editor', $change_func);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.