Activity::prefetch_comments()
Description #
Pre fetch comments of activities and cache them.
Source #
File: includes/class/class-activity.php
private function prefetch_comments() { global $wpdb; if ( empty( $this->ids['comment'] ) ) { return; } $ids = esc_sql( sanitize_comma_delimited( $this->ids['comment'] ) ); $comments = $wpdb->get_results( "SELECT * FROM {$wpdb->comments} WHERE comment_ID in ({$ids})" ); // phpcs:ignore WordPress.DB // Cache comments. foreach ( $comments as $_comment ) { wp_cache_set( $_comment->comment_ID, $_comment, 'comment' ); } }
Expand full source code Collapse full source code View on GitHub: includes/class/class-activity.php:258
Add your comment