Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with wordpress REST API /wp-json/wp/v2/comments endpoint #61

Open
ranjan-purbey opened this issue Sep 6, 2019 · 0 comments
Open

Comments

@ranjan-purbey
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant