I am trying to make a placeholder appear on the default html editor on a specific post type. The code looks like this:
add_filter('the_editor','add_placeholder_event');
function add_placeholder_event( $html ){
if ( 'event' == $post->post_type )
$html = preg_replace('/<textarea/', '<textarea placeholder="my place holder text" ', $html);
return $html;
}
It does not work, however, if I remove if ( 'event' == $post->post_type )
from the code it will work (but will apply to every html text editor on Wordpress).
Any idea what I am doing wrong?