How to add placeholder to wp_editor?
-
Here’s my function, and I want to add a placeholder for wp_editor(). However, there’s no default parameter available for this. How can I achieve it?
I’m using BuddyPress, and the following function is used for the “What’s New” textarea. I have replaced the simple textarea with wp_editor().
function show_whats_new_tinymce_editor($editor_id) { $current_user = wp_get_current_user(); $user_display_name = !empty($current_user->display_name) ? $current_user->display_name : __('User', 'reign'); $content = "What's new, {$user_display_name}?"; $settings = array( 'media_buttons' => false, 'textarea_name' => 'comment', 'textarea_rows' => 6, 'teeny' => false, 'tinymce' => array( 'wpautop' => true, 'toolbar1' => 'bold,italic,bullist,numlist,link,unlink,undo,redo,addmedia,addgif,videoembed,fullscreen', 'toolbar2' => '', 'branding' => false, 'statusbar' => true, // Show status bar for resizing 'resize' => true, // Allow resizing 'height' => 200, // Set default height 'extended_valid_elements' => 'a[href|target=_blank], iframe[src|width|height|frameborder|allowfullscreen]', 'rel_list' => array(array('title' => 'No Follow', 'value' => 'nofollow')), 'link_default_target' => '_blank' ), 'quicktags' => false ); $dark_mode = isset($_COOKIE['reign_dark_mode']) && $_COOKIE['reign_dark_mode'] === 'true'; $settings['tinymce']['content_css'] = $dark_mode ? get_stylesheet_directory_uri() . '/assets/css/dark-mode-editor.css' : ''; wp_editor($content, $editor_id, $settings); }
- You must be logged in to reply to this topic.