Activity::prefetch_posts()
Description #
Pre fetch question and answers and cache them.
Source #
File: includes/class/class-activity.php
private function prefetch_posts() { if ( empty( $this->ids['post'] ) ) { return; } global $wpdb; $ids_str = esc_sql( sanitize_comma_delimited( $this->ids['post'] ) ); $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} WHERE ID in ({$ids_str})" ); // phpcs:ignore WordPress.DB // Cache all posts. foreach ( $posts as $_post ) { wp_cache_set( $_post->ID, $_post, 'posts' ); } }
Expand full source code Collapse full source code View on GitHub: includes/class/class-activity.php:222
Add your comment