diff --git a/INSTALLATION.md b/INSTALLATION.md index 7be29da0..32ba7459 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -1224,7 +1224,7 @@ define( 'CONSTANT_NAME', value ); | FICTIONEER_SHORTCODE_TRANSIENT_EXPIRATION | integer | Expiration duration for shortcode Transients in seconds. Default `300`. | FICTIONEER_STORY_COMMENT_COUNT_TIMEOUT | integer | Timeout between comment count refreshes for stories in _seconds_. Default `900`. | FICTIONEER_REQUESTS_PER_MINUTE | integer | Maximum requests per minute and action if the rate limit is enabled. Default `5`. -| FICTIONEER_POST_NOT_IN_LIMIT | integer | Maximum allowed IDs in the 'post__not_in' query argument. Default `100`. +| FICTIONEER_QUERY_ID_ARRAY_LIMIT | integer | Maximum allowed IDs in 'post__{not}_in' query arguments. Default `100`. | FICTIONEER_OLD_POST_THRESHOLD | integer | Age of published post that is considered "old" in seconds. Default `30`. | FICTIONEER_CACHE_PURGE_ASSIST | boolean | Whether to call the cache purge assist function on post updates. Default `true`. | FICTIONEER_RELATIONSHIP_PURGE_ASSIST | boolean | Whether to purge related post caches. Default `true`. diff --git a/functions.php b/functions.php index d42ffbd2..d6636a98 100644 --- a/functions.php +++ b/functions.php @@ -259,11 +259,11 @@ if ( ! defined( 'FICTIONEER_REQUESTS_PER_MINUTE' ) ) { define( 'FICTIONEER_REQUESTS_PER_MINUTE', 5 ); } -// Integer: Maximum of 'post__not_in' query argument to prevent performance degradation. -// If exceeded, the whole argument will be ignored in certain queries, which account for -// this case in the view. -if ( ! defined( 'FICTIONEER_POST_NOT_IN_LIMIT' ) ) { - define( 'FICTIONEER_POST_NOT_IN_LIMIT', 100 ); +// Integer: Maximum number of IDs in 'post__in' and 'post__not_in' query arguments +// to prevent performance degradation. If exceeded, the whole argument will be +// ignored in certain queries, which account for. +if ( ! defined( 'FICTIONEER_QUERY_ID_ARRAY_LIMIT' ) ) { + define( 'FICTIONEER_QUERY_ID_ARRAY_LIMIT', 100 ); } // Integer: After how many seconds after saving is a post considered "old" diff --git a/includes/functions/_query_helpers.php b/includes/functions/_query_helpers.php index 68b1b335..cd5b2a8d 100644 --- a/includes/functions/_query_helpers.php +++ b/includes/functions/_query_helpers.php @@ -78,7 +78,7 @@ if ( ! function_exists( 'fictioneer_get_card_list' ) ) { if ( ! ( isset( $the_query_args['post__in'] ) && empty( $the_query_args['post__in'] ) ) ) { // Look for IDs to exclude if story or chapter... - if ( in_array( $post_type, ['fcn_story', 'fcn_chapter'] ) && FICTIONEER_POST_NOT_IN_LIMIT > 0 ) { + if ( in_array( $post_type, ['fcn_story', 'fcn_chapter'] ) && FICTIONEER_QUERY_ID_ARRAY_LIMIT > 0 ) { // Get complete set for filtering (required due to pagination) $all_query = new WP_Query( array_merge( $the_query_args, array( 'posts_per_page' => -1, 'no_found_rows' => true ) ) @@ -105,7 +105,7 @@ if ( ! function_exists( 'fictioneer_get_card_list' ) ) { } } - if ( ! empty( $excluded ) && count( $excluded ) <= FICTIONEER_POST_NOT_IN_LIMIT ) { + if ( ! empty( $excluded ) && count( $excluded ) <= FICTIONEER_QUERY_ID_ARRAY_LIMIT ) { $the_query_args['post__not_in'] = array_merge( $excluded, ( $the_query_args['post__not_in'] ?? [] ) ); } diff --git a/includes/functions/_utility.php b/includes/functions/_utility.php index cedc275b..a3af6988 100644 --- a/includes/functions/_utility.php +++ b/includes/functions/_utility.php @@ -186,7 +186,7 @@ function fictioneer_get_story_chapter_posts( $story_id ) { } // Few chapters? - if ( count( $chapter_ids ) < 50 ) { + if ( count( $chapter_ids ) <= FICTIONEER_QUERY_ID_ARRAY_LIMIT ) { // Query with post__in, which should be faster than meta query // as long as the ID array is not too large. $chapter_query = new WP_Query(