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

家住魔仙堡 提交于 2019-12-11 13:15:29

问题


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);
}

回答1:


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;
}


来源:https://stackoverflow.com/questions/15223801/the-editor-content-filter-change-the-content-of-other-textarea-in-wp-admin-in-ad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!