<p>如果你想批量给文章加密的话网上有这方面的插件,就是批量加密已发布文章( (#‵   ′ )凸这不废话嘛!)</p>
<p>如果想让博客发布日志时都自动加密的话得手动修改代码了,wp-admin/includes/meta-boxes.php 113行,</p>
<p>原始代码:</p>
<p> </p>

<p>if ( 'private' == $post-&gt;post_status ) { <br />$post->post_password = '';
$visibility = 'private'; <br />$visibility_trans = __('Private');
} elseif ( !empty( $post-&gt;post_password ) ) { <br />$visibility = 'password';
$visibility_trans = __('Password protected'); <br />} elseif ( $post_type == 'post' && is_sticky( $post-&gt;ID ) ) { <br />$visibility = 'public';
$visibility_trans = __('Public, Sticky'); <br />} else { <br />$visibility = 'public';
$visibility_trans = __('Public');
}</p>

<p> </p>
<p>修改后代码:</p>

<p>if ( 'private' == $post-&gt;post_status ) { <br />$post->post_password = '';
$visibility = 'private'; <br />$visibility_trans = __('Private');
} elseif ( !empty( $post-&gt;post_password ) ) { <br />$visibility = 'password';
$visibility_trans = __('Password protected'); <br />} elseif ( $post_type == 'post' && is_sticky( $post-&gt;ID ) ) { <br />$visibility = 'public';
$visibility_trans = __('Public, Sticky'); <br />} else { <br />$post->post_password = '123456';
$visibility = 'password'; <br />$visibility_trans = __('Password protected');
}</p>

<p>这样,在发布文章的时候,默认选中的就是密码保护类型,并且已经填写了默认的密码“123456”,如果你需要自定义密码,那——</p>
<p> </p>
<p>只好一篇一篇修改密码了!!!!</p>

最后修改:2019 年 06 月 06 日 08 : 22
如果觉得我的文章对你有用,请随意赞赏