Notifications::prefetch_posts()
Description #
Pre fetch post contents and append to object.
Source #
File: addons/notifications/query.php
public 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
foreach ( (array) $posts as $_post ) {
$this->append_ref_data( 'post', $_post->ID, $_post );
}
}
Expand full source code Collapse full source code View on GitHub: addons/notifications/query.php:126
Add your comment