Change include_protected to ignore_protected

Follows the WP default query better.
This commit is contained in:
Tetrakern 2023-09-14 11:56:30 +02:00
parent f14b417aa7
commit b1806dceba
2 changed files with 3 additions and 3 deletions

View File

@ -390,7 +390,7 @@ Renders paginated blog posts akin to the default blog page, but with options. Ma
* **per_page:** Number of posts per page. Defaults to theme settings.
* **ignore_sticky:** Whether sticky posts should be ignored or not. Default `false`.
* **include_protected:** Whether protected posts should be included or not. Default `false`.
* **ignore_protected:** Whether protected posts should be ignored or not. Default `false`.
* **author:** Only show posts of a specific author. Make sure to write the name right.
* **author_ids:** Only show posts of a comma-separated list of author IDs.
* **exclude_author_ids:** Comma-separated list of author IDs to exclude.

View File

@ -1355,7 +1355,7 @@ function fictioneer_shortcode_blog( $attr ) {
$exclude_author_ids = fictioneer_explode_list( $attr['exclude_author_ids'] ?? '' );
$author_ids = fictioneer_explode_list( $attr['author_ids'] ?? '' );
$ignore_sticky = filter_var( $attr['ignore_sticky'] ?? 0, FILTER_VALIDATE_BOOLEAN );
$include_protected = filter_var( $attr['include_protected'] ?? 0, FILTER_VALIDATE_BOOLEAN );
$ignore_protected = filter_var( $attr['ignore_protected'] ?? 0, FILTER_VALIDATE_BOOLEAN );
$rel = 'AND';
$classes = '';
@ -1416,7 +1416,7 @@ function fictioneer_shortcode_blog( $attr ) {
}
// Exclude protected
if ( ! $include_protected ) {
if ( $ignore_protected ) {
add_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
}