Powered By Blogger
Showing posts with label media. Show all posts
Showing posts with label media. Show all posts

Friday, October 27, 2017

bulk delete media OR remove media in wordpress

DELETE FROM `wp_posts` WHERE `post_type` = "attachment";
DELETE FROM `wp_postmeta` WHERE `meta_key` = "_wp_attached_file";
DELETE FROM `wp_postmeta` WHERE `meta_key` = "_wp_attachment_metadata";

Wednesday, December 28, 2016

Get count of post type in wordpress


/*Get count of attachment post type*/
$count_posts = wp_count_posts('attachment');