Title: custom function conflicts with plugin
Last modified: May 11, 2021

---

# custom function conflicts with plugin

 *  Resolved [devpaq](https://wordpress.org/support/users/devpaq/)
 * (@devpaq)
 * [5 years ago](https://wordpress.org/support/topic/custom-function-conflicts-with-plugin/)
 * I have a function that calls the latest comments but when I install your plugin
   it causes a fatal error.
    What would I need to change to my function so that 
   they don’t conflict?
 * Here is my function which gets called in the sidebar
 *     ```
       function bg_recent_comments($no_comments = 5, $comment_len = 80, $avatar_size = 48) {
       	$comments_query = new WP_Comment_Query();
       	$comments = $comments_query->query( array( 'number' => $no_comments ) );
       	$comm = '';
       	if ( $comments ) : foreach ( $comments as $comment ) :
       		$comm .= '<div class="individual-comment">Comment by <a class="author" href="' . get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID . '">';
       		$comm .= get_comment_author( $comment->comment_ID ) . ':</a> ';
       		$comm .= '<p>' . strip_tags( substr( apply_filters( 'get_comment_text', $comment->comment_content ), 0, $comment_len ) ) . '...</p></div>';
       	endforeach; else :
       		$comm .= 'No comments.';
       	endif;
       	echo $comm;	
       }
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [devpaq](https://wordpress.org/support/users/devpaq/)
 * (@devpaq)
 * [5 years ago](https://wordpress.org/support/topic/custom-function-conflicts-with-plugin/#post-14425549)
 * I narrowed it down a bit more.
    The conflict is with the `apply_filters( 'get_comment_text',
   $comment->comment_content )`
 *  Plugin Author [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * (@mpol)
 * [5 years ago](https://wordpress.org/support/topic/custom-function-conflicts-with-plugin/#post-14425720)
 * Hi, this code should work:
 * `apply_filters( 'get_comment_text', $comment->comment_content, $comment, array())`
 * When looking at the documentation you can see that the hook requires 3 parameters,
   none of the 3 parameters are optional.
    [https://developer.wordpress.org/reference/hooks/get_comment_text/](https://developer.wordpress.org/reference/hooks/get_comment_text/)
 * This solves it for you?
    Regards, Marcel
 *  Thread Starter [devpaq](https://wordpress.org/support/users/devpaq/)
 * (@devpaq)
 * [5 years ago](https://wordpress.org/support/topic/custom-function-conflicts-with-plugin/#post-14425814)
 * That worked!
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘custom function conflicts with plugin’ is closed to new replies.

 * ![](https://ps.w.org/zeno-report-comments/assets/icon-256x256.png?rev=1468613)
 * [Zeno Report Comments](https://wordpress.org/plugins/zeno-report-comments/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/zeno-report-comments/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/zeno-report-comments/)
 * [Active Topics](https://wordpress.org/support/plugin/zeno-report-comments/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/zeno-report-comments/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/zeno-report-comments/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [devpaq](https://wordpress.org/support/users/devpaq/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/custom-function-conflicts-with-plugin/#post-14425814)
 * Status: resolved