This repository has been archived by the owner on Apr 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Features/HideProtectedPosts): Remove password protected posts fr…
…om query (#205) * feat(HideProtectedPosts): Remove from query password protected posts Remove from query password protected posts if not in a singular page or in admin * feat(Features/HideProtectedPosts): Added a readme.md file
- Loading branch information
Showing
3 changed files
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Hide Protected Posts (Flynt Feature) | ||
|
||
Hide password protected posts from listings when using the loop or `get_posts`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Flynt\Features\HideProtectedPosts; | ||
|
||
add_action('pre_get_posts', function ($query) { | ||
if (!$query->is_singular() && !is_admin()) { | ||
$query->set('has_password', false); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters