Skip to content

Instantly share code, notes, and snippets.

@joehoyle
Last active October 12, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joehoyle/4040332 to your computer and use it in GitHub Desktop.
Save joehoyle/4040332 to your computer and use it in GitHub Desktop.
<?php
hm_add_rewrite_rule( array(
'request_method' => 'DELETE',
'regex' => '/api/v3/posts/([^/]+)',
'query' => 'post_id=$matches[1]',
'request_callback' => function( WP $wp ) {
wp_delete_post( $wp->query_vars['post_id'] );
exit;
}
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment