Use update_post_author_caches
Now this is sexy!
This commit is contained in:
parent
a31a1cef8d
commit
ae9bf11a37
@ -56,6 +56,11 @@ $query_args = apply_filters( 'fictioneer_filter_chapters_query_args', $query_arg
|
||||
// Query chapters
|
||||
$list_of_chapters = new WP_Query( $query_args );
|
||||
|
||||
// Prime author cache
|
||||
if ( function_exists( 'update_post_author_caches' ) ) {
|
||||
update_post_author_caches( $list_of_chapters->posts );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php get_header(); ?>
|
||||
|
@ -45,6 +45,11 @@ $query_args = apply_filters( 'fictioneer_filter_collections_query_args', $query_
|
||||
// Query collections
|
||||
$list_of_collections = new WP_Query( $query_args );
|
||||
|
||||
// Prime author cache
|
||||
if ( function_exists( 'update_post_author_caches' ) ) {
|
||||
update_post_author_caches( $list_of_collections->posts );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php get_header(); ?>
|
||||
|
@ -18,7 +18,14 @@ if ( ! function_exists( 'fictioneer_shortcode_query' ) ) {
|
||||
function fictioneer_shortcode_query( $args ) {
|
||||
// Transient for shortcodes disabled or in admin panel?
|
||||
if ( FICTIONEER_SHORTCODE_TRANSIENT_EXPIRATION < 1 || is_admin() ) {
|
||||
return new WP_Query( $args );
|
||||
$result = new WP_Query( $args );
|
||||
|
||||
// Prime author cache
|
||||
if ( ! empty( $result->posts ) && function_exists( 'update_post_author_caches' ) ) {
|
||||
update_post_author_caches( $result->posts );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Setup
|
||||
@ -33,6 +40,11 @@ if ( ! function_exists( 'fictioneer_shortcode_query' ) ) {
|
||||
$result = $transient;
|
||||
}
|
||||
|
||||
// Prime author cache
|
||||
if ( ! empty( $result->posts ) && function_exists( 'update_post_author_caches' ) ) {
|
||||
update_post_author_caches( $result->posts );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
@ -152,13 +152,19 @@ $disable_folding = fictioneer_get_field( 'fictioneer_story_disable_collapse' );
|
||||
)
|
||||
);
|
||||
|
||||
// Prime author cache
|
||||
if ( function_exists( 'update_post_author_caches' ) ) {
|
||||
update_post_author_caches( $chapter_query->posts );
|
||||
}
|
||||
|
||||
// Prepare chapter groups
|
||||
if ( $chapter_query->have_posts() ) {
|
||||
while( $chapter_query->have_posts() ) {
|
||||
// Setup
|
||||
$chapter_query->the_post();
|
||||
$chapter_id = get_the_ID();
|
||||
|
||||
// Skip not visible chapters
|
||||
// Skip not visible chapters (redundant for paranoia)
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_hidden' ) ) continue;
|
||||
|
||||
// Data
|
||||
|
@ -4,8 +4,8 @@ Author: Tetrakern
|
||||
Author URI: https://github.com/Tetrakern
|
||||
Donate link: [Support me on Ko-Fi](https://ko-fi.com/tetrakern)
|
||||
Contributors: tetrakern
|
||||
Requires at least: 6.0.0
|
||||
Tested up to: 6.2.0
|
||||
Requires at least: 6.1.0
|
||||
Tested up to: 6.2.2
|
||||
Requires PHP: 7.4
|
||||
Stable tag: 5.5.2
|
||||
License: GNU General Public License v3.0 or later
|
||||
|
@ -45,6 +45,11 @@ $query_args = apply_filters( 'fictioneer_filter_recommendations_query_args', $qu
|
||||
// Query recommendations
|
||||
$list_of_recommendations = new WP_Query( $query_args );
|
||||
|
||||
// Prime author cache
|
||||
if ( function_exists( 'update_post_author_caches' ) ) {
|
||||
update_post_author_caches( $list_of_recommendations->posts );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php get_header(); ?>
|
||||
|
@ -66,6 +66,11 @@
|
||||
// Query featured posts
|
||||
$featured_query = new WP_Query( $query_args );
|
||||
|
||||
// Prime author cache
|
||||
if ( function_exists( 'update_post_author_caches' ) ) {
|
||||
update_post_author_caches( $featured_query->posts );
|
||||
}
|
||||
|
||||
// Arguments for hooks and templates/etc.
|
||||
$hook_args = array(
|
||||
'collection' => $post,
|
||||
|
@ -57,6 +57,11 @@ $query_args = apply_filters( 'fictioneer_filter_stories_query_args', $query_args
|
||||
// Query stories
|
||||
$list_of_stories = new WP_Query( $query_args );
|
||||
|
||||
// Prime author cache
|
||||
if ( function_exists( 'update_post_author_caches' ) ) {
|
||||
update_post_author_caches( $list_of_stories->posts );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php get_header(); ?>
|
||||
|
@ -8,8 +8,8 @@ Contributors: tetrakern
|
||||
License: GNU General Public License v3.0 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl.html
|
||||
|
||||
Requires at least: 6.0.0
|
||||
Tested up to: 6.2.0
|
||||
Requires at least: 6.1.0
|
||||
Tested up to: 6.2.2
|
||||
Requires PHP: 7.4
|
||||
Version: 5.5.2
|
||||
Text Domain: fictioneer
|
||||
|
Loading…
x
Reference in New Issue
Block a user