【发布时间】:2019-01-14 06:30:18
【问题描述】:
您好,我想运行内容修改 sn-p,但仅限于受密码保护的帖子。
function func($content) {
if( $post->password_protected ){
$content = [whatever]
}
return $content;
}
add_filter('the_content', 'func');
如何进行密码保护检查?
【问题讨论】:
您好,我想运行内容修改 sn-p,但仅限于受密码保护的帖子。
function func($content) {
if( $post->password_protected ){
$content = [whatever]
}
return $content;
}
add_filter('the_content', 'func');
如何进行密码保护检查?
【问题讨论】:
我想通了
if( !empty($GLOBALS['post']->post_password) ){..}
【讨论】: