Skip to content

REST API

Comments: 7 routes.

All under /wp-json/davo/v1. Every route has a description in the source.

  • GET5
  • POST3
  • PUT1
  • PATCH1
  • DELETE2

/comments

GETPublic

Lists comments for a target, by target_type and target_id, with offset and limit. Unknown target types return 422.

Handler: cb_get_comments()

Parameters of GET /comments
ParameterTypeRequiredDefault or allowed values
target_typesee source——
target_idsee source——
offsetinteger—0
limitinteger——
curl
curl "https://example.com/wp-json/davo/v1/comments"

POSTAccess check: auth_require_comment

Creates a comment on a target as the current user.

Handler: cb_create_comment()

Parameters of POST /comments
ParameterTypeRequiredDefault or allowed values
target_typesee source——
target_idsee source——
contentstringYes—
curl
curl -X POST -u "user:application-password" "https://example.com/wp-json/davo/v1/comments" \
  -H "Content-Type: application/json" \
  -d '{"content": "…"}'

src/domains/comments/routes.php:70

/comments/{id}

GETPublic

Returns one comment.

Handler: cb_get_comment()

Parameters of GET /comments/{id}
ParameterTypeRequiredDefault or allowed values
idsee source——
curl
curl "https://example.com/wp-json/davo/v1/comments/{id}"

PUTPATCHAccess check: auth_require_login

Updates a comment's content as the current user.

Handler: cb_update_comment()

Parameters of PUT/PATCH /comments/{id}
ParameterTypeRequiredDefault or allowed values
idsee source——
contentstringYes—
curl
curl -X PUT -u "user:application-password" "https://example.com/wp-json/davo/v1/comments/{id}" \
  -H "Content-Type: application/json" \
  -d '{"content": "…"}'

DELETEAccess check: auth_require_login

Deletes a comment as the current user.

Handler: cb_delete_comment()

Parameters of DELETE /comments/{id}
ParameterTypeRequiredDefault or allowed values
idsee source——
curl
curl -X DELETE -u "user:application-password" "https://example.com/wp-json/davo/v1/comments/{id}"

src/domains/comments/routes.php:152

/comments/{id}/restore

POSTAccess check: auth_require_moderator

Restores a deleted comment.

Handler: cb_restore_comment()

Parameters of POST /comments/{id}/restore
ParameterTypeRequiredDefault or allowed values
idsee source——
curl
curl -X POST -u "user:application-password" "https://example.com/wp-json/davo/v1/comments/{id}/restore"

src/domains/comments/routes.php:727

/comments/{id}/vote

POSTAccess check: auth_require_vote_comment

Casts the current user's vote on a comment.

Handler: cb_vote_comment()

Parameters of POST /comments/{id}/vote
ParameterTypeRequiredDefault or allowed values
idsee source——
voteintegerYes—
curl
curl -X POST -u "user:application-password" "https://example.com/wp-json/davo/v1/comments/{id}/vote" \
  -H "Content-Type: application/json" \
  -d '{"vote": 1}'

DELETEAccess check: auth_require_login

Removes the current user's vote from a comment.

Handler: cb_remove_comment_vote()

Parameters of DELETE /comments/{id}/vote
ParameterTypeRequiredDefault or allowed values
idsee source——
curl
curl -X DELETE -u "user:application-password" "https://example.com/wp-json/davo/v1/comments/{id}/vote"

src/domains/comments/routes.php:190

/comments/admin

GETAccess check: auth_require_moderator

Lists comments for the admin screens, filterable by target type and id, status, author and search, with sorting and pagination. target_type and target_id accept comma- separated lists.

Handler: cb_get_comments_admin()

Parameters of GET /comments/admin
ParameterTypeRequiredDefault or allowed values
target_typestringYes—
target_idstringNo(empty)
statusstring—all | live | deleted
authorinteger—0
searchstring—(empty)
orderbystring—created_at | score
orderstring—asc | desc
pageinteger—1
per_pageinteger—20
curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/comments/admin?target_type=…"

src/domains/comments/routes.php:657

/comments/by-author

GETPublic

Author-scoped list across every target type — used by the Profile domain's Comments tab.

Handler: cb_get_comments_by_author()

Parameters of GET /comments/by-author
ParameterTypeRequiredDefault or allowed values
authorintegerYes—
pageinteger—1
per_pageinteger——
curl
curl "https://example.com/wp-json/davo/v1/comments/by-author?author=1"

src/domains/comments/routes.php:117

/comments/dashboard-stats

GETAccess check: auth_require_moderator

Callback: GET /comments/dashboard-stats — aggregate stats for the admin dashboard. Moderator-only (see auth_require_moderator()) — this exposes site-wide counts, not something a regular viewer needs.

Handler: cb_get_dashboard_stats()

Parameters of GET /comments/dashboard-stats
ParameterTypeRequiredDefault or allowed values
daysinteger—30
curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/comments/dashboard-stats"

src/domains/comments/routes.php:598

Note. Generated from the plugin source. Parameters are the ones declared when the route is registered; a parameter marked “see source” uses a shared definition. Responses are not documented here. Authenticate as for any WordPress REST route, for example with an application password over HTTPS; the example paths use https://example.com.

See it on your own site.

Davo is a WordPress theme and plugin by Exorex.

  • Runs on your own WordPress
  • Guided setup wizard
  • AI is off until you switch it on
  • Read the licence on the marketplace first