Last active
March 16, 2018 11:37
-
-
Save certainlyakey/f08597d24fa6966f6d7a308e3d20639f to your computer and use it in GitHub Desktop.
Add a placeholder to TinyMCE editor (Wordpress)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function set_mce_editor_placeholder_question($textarea_html) { | |
if ('question' !== get_post_type()) return $textarea_html; | |
$placeholder = __( 'Please enter some text as the question...', 'site_domain'); | |
$textarea_html = preg_replace( '/<textarea/', "<textarea placeholder=\"{$placeholder}\"", $textarea_html ); | |
return $textarea_html; | |
} | |
add_filter( 'the_editor', 'set_mce_editor_placeholder_question' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment