I am trying to dynamically add/remove comments before displaying them. In comments.php, I have:
$comment_id = wp_insert_comment( $commentdata ); .......... /* end of my code */ /*beginning of original theme code*/ ........ wp_list_comments();
The problem is that the newly added comment is not displayed until page refresh. I figure this is because the Loop works with cached comments stored in $wp_query. What is the best way to update the comment cache while keeping all the Loop counters intact? I would like to have a piece of code that can be just pasted into any theme without interfering with its original comment code. Performance is an issue, too.
- The topic ‘Updating $wp_query inside the Loop’ is closed to new replies.