Skip to content

Instantly share code, notes, and snippets.

@jmarreros
Created November 13, 2016 03:45
Show Gist options
  • Save jmarreros/d78649ab0a249295a09dae4f54351198 to your computer and use it in GitHub Desktop.
Save jmarreros/d78649ab0a249295a09dae4f54351198 to your computer and use it in GitHub Desktop.
En donde 123 es el ID del post a eliminar.
<?php
$host = 'http:/tudominio.com/wp-json/wp/v2/posts/123';
$headers = array(
'Content-Type:application/json',
'Authorization: Basic '. base64_encode('admin:clave')
);
$ch = curl_init($host);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
curl_close($ch);
echo($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment