WHAT IS | Delete the given posts ID. |
DONE | Called on deletion completed. |
ERROR | Called on a system error. |
USED WP METHODS | wp_delete_post |
_ = wpPosts.$Delete$(%postsID, %^forceDelete^).$Done$(%doneCallback%) .$Error$(%errorCallback%) .$Run$();
postsID|array<int>
The array of the IDs of the posts to delete.
__
forceDelete|(bool)
Default: false
By default, deleted Posts will be stored in WordPress’s trash. If set to true, the Posts will be permanently deleted.
__
doneCallback|function
The function to call when the operation will be completed.
Note: the use of the Done() method is mandatory.
__
errorCallback|(function)
The function to call in case of error.
Note: the use of the Error() method is optional and can be omitted.
{{{#912c9a|WPReply|Data-type|Property or method description}}}
__
.isOK|bool
true if everything is ok, false in case of error.
__
.isError|bool
true in case of error, false if everything is ok.
__
.error|string
The error message from the Server. It can be a string generated by WordPress through its get_error_message method (see the WP manual).
__
errorType|HttpRequest.Error Enum
The kind of error:
NONE = no error.
HTTP_ERROR = communication error.
SYSTEM_ERROR = UniWP error.
WORDPRESS_ERROR = error message from WordPress REST APIs.
var myPosts = new UniWP.Posts();
_ = myPosts.Delete(new int[] {1, 10, 12, 24}, true)
.Done((WPReply reply) =>
{
if (reply.isOK) Debug.Log("Posts permanently deleted!");
})
.Error((WPReply reply) =>
{
Debug.LogError(reply.error);
})
.Run()