Created
September 11, 2016 02:33
-
-
Save boonebgorges/c2f6310f6ba770bdad471c78dffb0f23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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