Can you help me with something simple?
How can I get the post id of the last approved comment? I want to assign it to a variable.
Thanks so much in advance!
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
<?php $recent_comments = get_comments( array( 'number' => 1, 'status' => 'approve' ) ); foreach($recent_comments as $comment) : $latest_postid_with_comment = $comment->comment_post_ID; endforeach; ?>
Probably way to compress this code into something smaller. But this will work.