AnsPress_Reputation_Query::prefetch_posts()
Description #
Pre fetch post contents and append to object.
Source #
File: includes/reputation.php
public function prefetch_posts() { global $wpdb; $ids = array_merge( $this->ids['post'], $this->ids['answer'], $this->ids['question'] ); $ids = esc_sql( sanitize_comma_delimited( $ids ) ); if ( ! empty( $ids ) ) { $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} WHERE ID in ({$ids})" ); // phpcs:ignore WordPress.DB foreach ( (array) $posts as $_post ) { $this->reputations[ $this->pos[ $_post->ID ] ]->ref = $_post; } } }
Expand full source code Collapse full source code View on GitHub: includes/reputation.php:716
Add your comment