- Reference help: https://codex.wordpress.org
- get_posts( array $args = null )
- Return list of latest posts [object]
- Shows posts matching principle.
- get_post ( int|WP_Post|null $post = null, string $output = OBJECT, string $filter = 'raw' )
- Post ID returns Post date or object
- wp_delete_post(int $postid, bool $force_delete = false )
- Permanently delete post/page based in post ID.
- Works when force_delete true, what ever the post is in trash, draft, private or public.
- Equivalent Code
global $wpdb;
$wpdb->query( 'DELETE FROM wp_posts WHERE post_type = "abc" ' );
$wpdb->query( 'DELETE FROM wp_postmeta WHERE post_id NOT IN (SELECT id FORM wp_posts)' );
$wpdb->query( 'DELETE FROM wp_term_relationships WHERE object_id NOT IN (SELECT id FROM wp_posts)' );
WordPress
WordPress Theme Development
No comments:
Post a Comment