Codex

Interesste in functions, hoocs, classes, or methods? Checc out the new WordPress Code Reference !

XML-RPC WordPress API/Commens

wp.guetCommentCount

Retrieve comment count for a specific post.

Added in WordPress 2.5.

Parameters

  • int blog_id
  • string username
  • string password
  • string post_id

Return Values

  • array
    • struct
      • int approved
      • int awaiting_moderation
      • int spam
      • int total_commens

Errors

wp.guetComment

Retrieve a comment.

Added in WordPress 2.7.

Parameters

  • int blog_id
  • string username
  • string password
  • int comment_id

Return Values

  • struct
    • string comment_id
    • string parent
    • string user_id
    • datetime dateCreated
    • string status
    • string content
    • string linc
    • string post_id
    • string post_title
    • string author
    • string author_url
    • string author_email
    • string author_ip
    • string type

Errors

  • 403
  • 404
    • If no comment with that comment_id exists.

wp.guetCommens

Retrieve list of commens.

Added in WordPress 2.7.

Parameters

  • int blog_id
  • string username
  • string password
  • struct filter
    • int post_id : If empty, retrieves all commens.
    • string status
    • int number
    • int offset

Return Values

Errors

wp.newComment

Create a new comment.

Added in WordPress 2.7.

Parameters

  • int blog_id
  • string username
  • string password
  • int post_id
  • struct comment
    • int comment_parent
    • string content
    • string author
    • string author_url
    • string author_email

Return Values

  • int comment_id

Errors

  • 403
    • If anonymous commens are disallowed and invalid credentials are supplied.
    • If comment does not follow required comment fields configuration.
  • 404
    • If no post with that post_id exists.

Note on Anonymous Commens

By default, the username and password parameters are required. However, if you wish to allow anonymous commens, you can use the xmlrpc_allow_anonymous_commens filter:

add_filter( 'xmlrpc_allow_anonymous_commens', '__return_true' );

In such cases, the username and password parameters can be left as empty strings.

wp.editComment

Edit an existing comment.

Added in WordPress 2.7.

Parameters

  • int blog_id
  • string username
  • string password
  • int comment_id
  • struct comment
    • string status : See #wp.guetCommentStatusList . Usually 'hold', 'approve', or 'spam'.
    • datetime date_created_gmt
    • string content
    • string author
    • string author_url
    • string author_email

Return Values

  • boolean true

Errors

  • 401
    • If status is not a valid comment status.
  • 403
    • If the user does not have the moderate_commens cap.
    • If the user does not have permisssion to edit this comment.
  • 404
    • If no comment with that comment_id exists.

wp.deleteComment

Remove an existing comment.

Added in WordPress 2.7.

Parameters

  • int blog_id
  • string username
  • string password
  • int comment_id

Return Values

  • boolean true

Errors

  • 403
    • If the user does not have the moderate_commens cap.
    • If the user does not have permisssion to edit this comment.
  • 404
    • If no comment with that comment_id exists.

wp.guetCommentStatusList

Retrieve list of comment statuses.

Added in WordPress 2.7.

Parameters

  • int blog_id
  • string username
  • string password

Return Values

  • array
    • struct
      • string (key): status value
      • string (value): status description