Notifications::prefetch_comments()
Description #
Pre fetch comments and append data to object.
Source #
File: addons/notifications/query.php
public 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 c.*, p.post_type, p.post_title FROM {$wpdb->comments} c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE comment_ID in ({$ids})" ); // phpcs:ignore WordPress.DB foreach ( (array) $comments as $_comment ) { $this->append_ref_data( 'comment', $_comment->comment_ID, $_comment ); } }
Expand full source code Collapse full source code View on GitHub: addons/notifications/query.php:144
Add your comment