<p><!-- comment --></p>谢谢.UPD2:很明显,使用add_filter()和the_content函数是可能的(必要的)
但你是怎么做的呢?提速?
必须在页面或记录上有标记,并在其位置显示“无”。
就像..。(我不知道该写些什么来代替"nothing“的注释标签。
/* Add empty paragraph only to Pages. */
function tag_comment_empty_added_page_content ( $content ) {
if ( is_page() ) {
return $content . '<!-- * -->';
}
return $content;
}
add_filter( 'the_content', 'tag_comment_empty_added_page_content');或者在这条静脉里?
<?php
function tag_comment_empty_replace_content( $text_content ) {
if ( is_page() ) {
$text = array(
'<!-- * -->' => '',
);
$text_content = str_ireplace( array_keys( $text ), $text, $text_content );
}这一切都不起作用,在某个错误的地方。
发布于 2022-04-15 17:51:07
假设您将内容存储为posts,则可以为the_content创建一个筛选器,以便在内容回显时删除所有注释。
https://developer.wordpress.org/reference/hooks/the_content/
https://stackoverflow.com/questions/71858468
复制相似问题