mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-05 12:32:23 +08:00
https://connekthq.com/plugins/ajax-load-more/docs/code-samples/exclude-password-protected-posts/
6 lines
260 B
Text
6 lines
260 B
Text
add_action( 'pre_get_posts', 'alm_exclude_password_protected_posts' );
|
|
function alm_exclude_password_protected_posts( $alm_query ) {
|
|
if ( isset( $alm_query->query['alm_id'] ) && ! $alm_query->is_singular() ) {
|
|
$alm_query->set( 'has_password', false );
|
|
}
|
|
}
|