When accessing the above-mentioned endpoint with wp-ulike plugin installed, the following notice is generated:
Notice: Trying to get property 'comment_ID' of non-object in /var/www/html/wp-includes/comment-template.php on line 673
This renders the JSON invalid. On debugging I found that wp_ulike_comments() function calls get_comment_ID which depends on the global $GLOBALS['comment'] to get the current comment. This variable is set by an instance of Walker_Comment class (or its subclass), which is instantiated in the get_comment_pages_count function of the file wp-includes/comment.php. Probably this function is not called when accessing the comments endpoint through rest API, and hence the notice.
I know I can set the WP_DEBUG flag to false and get rid of the notice, but this seems like broken.
When accessing the above-mentioned endpoint with wp-ulike plugin installed, the following notice is generated:
This renders the JSON invalid. On debugging I found that
wp_ulike_comments()function callsget_comment_IDwhich depends on the global$GLOBALS['comment']to get the current comment. This variable is set by an instance ofWalker_Commentclass (or its subclass), which is instantiated in theget_comment_pages_countfunction of the filewp-includes/comment.php. Probably this function is not called when accessing the comments endpoint through rest API, and hence the notice.I know I can set the
WP_DEBUGflag tofalseand get rid of the notice, but this seems like broken.