WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
Removing a post (6 posts)

  1. agent207
    Member
    Posted 1 year ago #

    Is there a way to remove a post using JSON API?

    http://wordpress.org/extend/plugins/json-api/

  2. Dave van Hoorn
    Member
    Posted 1 year ago #

    Hi,

    I created a controller for deleting a post by ID. Save the PHP code from the following link as 'postsextra.php' in the plugins -> json-api -> controllers folder.

    Link
    http://pastebin.com/0mT3zSzp

    Usage
    1. Request a nonce using the following URL:
    http://www.yourdomain.com/app/get_nonce/?controller=postsextra&method=delete_post

    2. Then use the nonce to delete the post by ID, in this case post with ID 153
    http://www.yourdomain.com/app/postsextra/delete_post/?nonce=c4dec48dbc&id=153

    Have a good one :)

  3. agent207
    Member
    Posted 1 year ago #

    Thank you, Freshcode.

  4. agent207
    Member
    Posted 1 year ago #

    One question Freshcode. When I execute the command I get the following error.

    "error": "Unknown controller 'postsextra'."

    Does this need to initialize?

  5. Dave van Hoorn
    Member
    Posted 1 year ago #

    You need to activate the controller in the plugin settings. WP Dashboard -> Settings -> JSON API -> activate the Posts Extra controller

  6. agent207
    Member
    Posted 1 year ago #

    OOPS! Thank you again, Freshcode. It now works fine.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic