Dev Docs
  • Disciple.Tools Technical Documentation
  • Theme Core
    • API - Posts
      • List of Endpoints
      • Fields Format
      • Get Post
      • Create Post
      • Update Post
      • Post Comments
      • Post Activity
      • List Query
      • Global Search
      • Posts in Typeaheads
      • Post-Sharing
      • Get Following
      • Settings
    • API - Other
      • Users
      • Locations
      • Settings
    • Hooks
      • Record Page Hooks
      • API-Hooks
      • Public settings
      • Adding menu navigation links
    • Customization
      • Fields
      • Custom Post Types
      • Post Type Modules
      • Adding Fields and Tiles.
    • Authentication
      • JWT-Authentication-for-the-mobile-app
      • Site-to-Site-Link
      • Easy-Example
    • Permissions
    • Roles and Permissions
    • Database Tables
      • Activity Table
    • Disciple.Tools Translation
    • Revisions
      • v1.0.0-dev-changes
      • v1.0
  • Hosting
    • 404 Errors on new install
    • CRON
    • Hosting on WPEngine
    • Backups
    • Single Site or MultiSite
  • Disciple.Tools Development Setup
    • LocalWP
    • Mobile App Setup
    • Unit Tests
    • Cypress Tests
    • D.T on Docker Setup
    • Gulp - CSS and JS
  • Code Contribution
    • Theme Contribution Guidelines
    • How to Correctly Contribute to the Disciple Tools Repository
    • How to Translate Your Plugin
  • Style Guide
  • Disciple.Tools Code of Conduct
Powered by GitBook
On this page
  • Get comments
  • Parameters
  • Returns
  • Create a comment
  • Parameters
  • Returns
  • Update a comment
  • Parameters
  • Returns
  • Delete a comment
  • Returns

Was this helpful?

Edit on Git
  1. Theme Core
  2. API - Posts

Post Comments

PreviousUpdate PostNextPost Activity

Last updated 1 year ago

Was this helpful?

Get comments

Get

Parameters

  • number (int) optional. How many comments to return

  • offset (int) optional. How many comments to skip (for pagination)

Returns

[ 
   comments: (array) An array of comments.
   total: (int) the number of comment in total
]

Includes comment meta data and reactions along with default comment:

{
   "comments": [{
       ...
       "comment_reactions": {
           "reaction_thumbs_up": [
               { "name": "admin", "user_id": "1" },
               { "name": "user1", "user_id": "2" }
           ],
           "reaction_heart": [
               { "name": "admin", "user_id": "1" }
           ]
       },
       "comment_meta": {
           "audio_url": [
               { "id": "1", "value": "https://my.path/to/audio.mp3" },
               { "id": "2", "value": "https://my.path/to/audio.ogg" },
           ]
       }
   }]
}

Create a comment

Parameters

  • comment (string) the body of the comment.

  • date (string) optional. format "Y-m-d H:i:s"

  • comment_type (string) optional. The comment type. Default: 'comment'

  • meta (object) optional. Additional meta data

Query params: add ?silent=true to disable notifications

@mentions Mention are used to make sure a user sees a comment and gets a notification. This example @mentions user with id 46 and will display bob as the name of the user.

{
    "comment": "@[bob](46) this is a mention notification"
}

links Create a link to another record, page or site

{
    "comment": "See changes on [link text](link url)
}

meta data Create additional meta data - such as reactions or audio files - by passing a meta data object with the key/value pairs to be created. Values can be primitive types (string, int, etc) or arrays.

{
    "meta": {
        "audio_url": [
            "https://my.path/to/audio.mp3",
            "https://my.path/to/audio.ogg"
        ]
    }
}
{
    "meta": {
        "audio_url": "https://my.path/to/audio.ogg"
    }
}

Returns

Includes comment meta data along with default comment:

{
    "comment_meta": {
        "audio_url": [
            "https://my.path/to/audio.mp3",
            "https://my.path/to/audio.ogg"
        ]
    }
}

Update a comment

Parameters

  • comment (string) the body of the comment.

  • meta (object) optional. Additional meta data

Returns

Includes comment meta data along with default comment:

{
    "comment_meta": {
        "audio_url": [
            "https://my.path/to/audio.mp3",
            "https://my.path/to/audio.ogg"
        ]
    }
}

Delete a comment

Returns

(bool) true if the contact was deleted

POST

(object) The default wordpress comment. See

POST

(object) The default wordpress comment. See

DELETE

https://example.com/wp-json/dt-posts/v2/{post_type}/{post_id}/comments
https://example.com/wp-json/dt/v2/{post_type}/{post_id}/comments
https://developer.wordpress.org/reference/functions/get_comment/
https://example.com/wp-json/dt/v2/{post_type}/{post_id}/comments/{comment_id}
https://developer.wordpress.org/reference/functions/get_comment/
https://example.com/wp-json/dt/v2/{post_type}/{post_id}/comments/{comment_id}