【问题标题】:WordPress snippet - post password protection checkWordPress 片段 - 发布密码保护检查
【发布时间】:2019-01-14 06:30:18
【问题描述】:

您好,我想运行内容修改 sn-p,但仅限于受密码保护的帖子。

function func($content) {

   if( $post->password_protected ){
      $content = [whatever]
   }

   return $content;
}
add_filter('the_content', 'func');

如何进行密码保护检查?

【问题讨论】:

    标签: wordpress code-snippets


    【解决方案1】:

    我想通了

    if( !empty($GLOBALS['post']->post_password) ){..}
    

    【讨论】:

      猜你喜欢
      • 2017-07-24
      • 1970-01-01
      • 2021-06-10
      • 2011-04-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-27
      • 2011-06-21
      相关资源
      最近更新 更多