最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ajax - How to get parent comment's id?

programmeradmin9浏览0评论

I am trying to submit comment in Wordpress with Ajax request, but I am struggling with getting the parent comment's id. Is there any function I can use to get them?

I am trying to submit comment in Wordpress with Ajax request, but I am struggling with getting the parent comment's id. Is there any function I can use to get them?

Share Improve this question asked Feb 28, 2020 at 14:53 WinstonWinston 1452 silver badges10 bronze badges 4
  • 1 In what context? When? – Jacob Peattie Commented Feb 28, 2020 at 15:40
  • I want to get the parent comment's id in the Ajax handler when I am trying to save comment data passed through $_POST. How can I do that? – Winston Commented Feb 29, 2020 at 2:12
  • You need to send the parent comment's ID along with the request. – Jacob Peattie Commented Feb 29, 2020 at 2:19
  • But how can I get parent comment's ID with PHP? If I can get it then I can send it though wp_localize_script – Winston Commented Feb 29, 2020 at 2:27
Add a comment  | 

1 Answer 1

Reset to default -1

Since you use Ajax, then I would get the current comment from the REST Api, and then get the parent from that.

发布评论

评论列表(0)

  1. 暂无评论