public function remove($category_slug, $post_slug) { $post = $this->get_postby_category_slug_post_slug($category_slug, $post_slug); $post = new TimberPost($post->ID); $keys = array('apple_news_api_id', 'apple_news_api_created_at', 'apple_news_api_modified_at', 'apple_news_api_share_url', 'apple_news_api_revision', 'apple_news_api_deleted'); $compiler = new Compiler($post); echo $compiler->delete_post(); foreach ($keys as $key) { echo delete_post_meta($post->id, $key); echo "<br>"; } echo "Deleted"; }
public function custom_delete($post_id) { if (wp_is_post_revision($post_id)) { return; } $post = new TimberPost($post_id); if (!in_array($post->post_type, array('post', 'feature', 'partnership'))) { return; } $post = new TimberPost($post_id); $compiler = new Compiler($post); $compiler->delete_post($post); }