我在wp admin中有多个文本区域在post add/edit部分,我试图改变wp的默认文本区域的内容,但当我执行the_editor_content过滤器时,它改变了默认文本区域的内容,但它也改变了其他文本区域的内容,是否有任何方法来改变只有默认文本区域的内容?
注意*其他文本区域有不同的id
我使用的代码:
add_filter( 'the_editor_content', 'my_editor_content' );
function my_editor_content() {
global $post;
return search_keywords($post->post_content, $keyword1,$keyword2,$keyword3);
}
我认为你需要像这样钩住default_content
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
$content = "This is my default content!";
return $content;
}