Skip to content

Commit

Permalink
Pass comment object as parameter rather than using global variable (r…
Browse files Browse the repository at this point in the history
…emoved in WP4.4)
  • Loading branch information
Stephen-Cronin committed Nov 11, 2015
1 parent 31ec862 commit 38f715f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions show-parent-comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@
/**
* Filter comments and add parent comment to output
*/
function spc_show_parent_comment( $content ) {

// get the global comment variable
global $comment;
function spc_show_parent_comment( $content, $comment ) {

// if there's no parent comment, return the comment text unchanged
if ( ! $comment->comment_parent ) {
Expand All @@ -63,7 +60,7 @@ function spc_show_parent_comment( $content ) {
* Call function to filter comments on Admin requests
*/
function spc_show_parent_comment_admin() {
add_filter( 'get_comment_text', 'spc_show_parent_comment' );
add_filter( 'get_comment_text', 'spc_show_parent_comment', 10, 2 );
}
add_action( 'admin_init', 'spc_show_parent_comment_admin' );

Expand Down

0 comments on commit 38f715f

Please sign in to comment.