Password protection for page template
This is because password protection applied on get_the_content()
function. And you are not using it instead you’ve written your own custom loop.
So you can alter the code before loop and check if page is not password protected using function post_password_required()
and then display form using get_the_password_form()
else display loop.
Example:-
if ( post_password_required( get_the_ID() ) ) {
echo get_the_password_form( get_the_ID() );
} else {
$wp_query = new WP_Query();
$wp_query->query('&cat=9' . '&paged=' . $paged);
while ($wp_query->have_posts()) :
$wp_query->the_post(); ?>
<div class="post-list">
<div class="post-list-title"><a href="https://wordpress.stackexchange.com/questions/226861/<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
<div class="short-text">
<?php the_content('More >>'); ?>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata();
}