the_editor_content filter change the content of other textarea in wp admin in add/edit post section?

StackOverflow https://stackoverflow.com/questions/15223801

  •  18-03-2022
  •  | 
  •  

Question

I have more then one text areas in wp admin in post add/edit section, i am trying to change the content of by default textarea of wp but when i execute the the_editor_content filter, it change the content of by default textarea but it also change the content of other textareas,is there any way to to change the content of only by default textarea?

Note* Other textareas have different ids

code i used :

add_filter( 'the_editor_content', 'my_editor_content' );
function my_editor_content() {
    global $post;
    return search_keywords($post->post_content, $keyword1,$keyword2,$keyword3);
}
Was it helpful?

Solution

I think you need to hook into default_content like this

add_filter( 'default_content', 'my_editor_content' );

function my_editor_content( $content ) {

$content = "This is my default content!";

return $content;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top