masy

设置wordpress发布文章默认加密
如果你想批量给文章加密的话网上有这方面的插件,就是批量加密已发布文章( (#‵   ′ )凸这...
扫描右侧二维码阅读全文
19
2012/08

设置wordpress发布文章默认加密

如果你想批量给文章加密的话网上有这方面的插件,就是批量加密已发布文章( (#‵   ′ )凸这不废话嘛!)

如果想让博客发布日志时都自动加密的话得手动修改代码了,wp-admin/includes/meta-boxes.php 113行,

原始代码:

 

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

 

修改后代码:

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

这样,在发布文章的时候,默认选中的就是密码保护类型,并且已经填写了默认的密码“123456”,如果你需要自定义密码,那——

 

只好一篇一篇修改密码了!!!!

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

发表评论