【问题标题】:Is it possible to create an unapproved comment using the WordPress XMLRPC API?是否可以使用 WordPress XMLRPC API 创建未经批准的评论?
【发布时间】:2014-08-29 01:56:18
【问题描述】:

我正在尝试创建评论,使用 WordPress 的 XMLRPC API 的 Python library,并将评论的状态设置为未批准或“保留”。但所有通过 API 插入的 cmets 似乎都会创建已批准的 cmets。

  comment = WordPressComment()
  comment.content = body
  comment.status = 'hold'
  wp.call(NewComment(post_id, comment))

create cmets 方法不支持这个参数吗?

【问题讨论】:

    标签: python wordpress


    【解决方案1】:

    回答:不能直接通过在 NewComment 请求上设置状态来实现。

    但您可以使用pre_comment_approved 过滤器来定义自己的处理程序,并在评论插入数据库时​​添加未批准状态。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-16
    • 1970-01-01
    • 1970-01-01
    • 2012-04-17
    • 1970-01-01
    • 2023-03-03
    • 2021-06-03
    相关资源
    最近更新 更多