Support » Plugins and Hacks » Preset text in editor

  • Hello folks, i tried this piece of code to preset some text in the editor in the functions.php:

    <?php
    
    add_filter( 'default_content', 'my_editor_content' );
    
    function my_editor_content( $content ) {
    
    	$content = "This is some custom content I'm adding to the post editor because I hate re-typing it.";
    
    	return $content;
    }
    
    ?>

    But, when i add html code like this:

    .....
    function my_editor_content( $content ) {
    
    	$content = "<img src="" width="100%" height="100%">
    text
    <h3>Download</h3>
    <a href="" target="_blank"></a>";
    
    .....
    
    ?>

    it doesnt work. I understand why, because all the “” are fighting with eachother, but how should i write that piece of code so that it works in the editor? Now tha whole page gets white, and i have to reupload the backup php file to make my site work again.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Preset text in editor’ is closed to new replies.