AnsPress_Notification_Query::prefetch_comments()
Description #
Pre fetch comments and append data to object.
Source #
File: addons/free/notification/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})" ); 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/free/notification/query.php:146
Add your comment