Duplicate post
POST
/wp-json/wp2/post-duplicator/v1/posts/{post_id}/duplicate
const url = 'https://example.com/wp-json/wp2/post-duplicator/v1/posts/1/duplicate';const options = { method: 'POST', headers: {'X-WP-Nonce': '<X-WP-Nonce>', 'Content-Type': 'application/json'}, body: '{"title":"example","replace_ids":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/wp-json/wp2/post-duplicator/v1/posts/1/duplicate \ --header 'Content-Type: application/json' \ --header 'X-WP-Nonce: <X-WP-Nonce>' \ --data '{ "title": "example", "replace_ids": true }'Synchronously creates one copy of the post (content and meta per module rules). Returns the new post payload.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”post_id
required
integer
WordPress post ID.
Request Body
Section titled “Request Body”Media typeapplication/json
object
title
required
Title.
string
replace_ids
Rewrite internal IDs in copy content. Default true.
boolean
Responses
Section titled “Responses”Media typeapplication/json
object
post_id
WordPress post ID.
integer
title
Title.
string
edit_link
Field “edit_link” as returned or accepted by PHP.
string
Examplegenerated
{ "post_id": 1, "title": "example", "edit_link": "example"}Not authenticated. WordPress REST: rest_not_logged_in / rest_forbidden. Use cookie + X-WP-Nonce or Application Password.
Media typeapplication/json
object
code
Machine-readable error or event code.
string
message
Message text (log, PIN, or password reset).
string
data
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}Insufficient capability or invalid REST nonce. WordPress REST: rest_forbidden / rest_cookie_invalid_nonce.
Media typeapplication/json
object
code
Machine-readable error or event code.
string
message
Message text (log, PIN, or password reset).
string
data
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}