Bạn thêm đoạn mã sau vào footer.php.
<?php if (is_singular('post')) : ?>
<script type="text/javascript">
<?php
if (is_user_logged_in()) :
$post = get_post();
$post_password = '';
if (isset($post->post_password)) $post_password = $post->post_password;
?>
$(document).ready(function() {
if ($('.post-password-required').length) {
$('#password-form input.password-input').val('<?php echo esc_attr($post_password); ?>');
$('#password-form .post-password-form').submit();
}
});
<?php endif; ?>
</script>
<?php endif; ?>
Hoặc bạn muốn tài khoản VIP mới không cần nhập mật khẩu thì tham khảo bài viết này nhé.
Chúc các bạn thành công!
Bình luận