Skip to content

Instantly share code, notes, and snippets.

@boonebgorges
Created September 11, 2016 02:33
Show Gist options
  • Save boonebgorges/c2f6310f6ba770bdad471c78dffb0f23 to your computer and use it in GitHub Desktop.
Save boonebgorges/c2f6310f6ba770bdad471c78dffb0f23 to your computer and use it in GitHub Desktop.
<?php
$comment = get_comment( 12345 );
$post_id = $comment->comment_post_ID();
$post = get_post( $post_id ); // Let's say post_title = Foo
do_action( 'comment_goodies', $comment, $post );
var_dump( $post );
<?php
add_action( 'comment_goodies', function( $comment, $post ) {
wp_update_post( array(
'ID' => $post->ID,
'post_title' => 'Bar',
) );
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment