<?php echo '<pre>'; echo '<span style="color:blue">DOWNLOADING...</span>'.PHP_EOL; // Download file file_put_contents('wp.zip', file_get_contents('https://wordpress.org/latest.zip')); $zip = new ZipArchive();…
Update some meta for all media library items
Only run this once! uncomment the „add_action“ then open site and then comment it out again. Watch your timeout depending on how many images you have.
/*
* Update ALL attachments metada with Width and Height
*
* Important: Run Only Once
*
*/
//add_action('admin_init','wpse_35680_run_only_once');
function wpse_35680_run_only_once()
{
global $wpdb;
$attachments = $wpdb->get_results( "SELECT ID FROM $wpdb->posts WHERE post_mime_type LIKE '%image%'" );
foreach( $attachments as $att )
{
list( $url, $width, $height ) = wp_get_attachment_image_src( $att->ID, 'full' );
update_post_meta( $att->ID, '_width', $width );
update_post_meta( $att->ID, '_height', $height );
}
}
