Media library on another server?

I would suggest that you use a CDN to host your image files. For starters you could move the images over to the new hosting though. Or is it many terrabytes of images? If so, I don’t think it’s a good idea to have them in WordPress. Regarding hosting the image library, have you considered … Read more

How to manage a music library in wordpress

You can register a custom post type called songs or albums. Learn more about custom post type registration here: https://codex.wordpress.org/Function_Reference/register_post_type More info on Post Type: https://codex.wordpress.org/Post_Types You can register custom taxonomies in WordPress as well. Learn about taxonomies here: https://codex.wordpress.org/Taxonomies Learn about taxonomy registration here: https://codex.wordpress.org/Function_Reference/register_taxonomy You can then associate songs or albums with an … Read more

Media Library Latency, Lag, CRON?

When I add images to my Media Library they aren’t available in the Media Library for about an hour. It seems like there is a queue or some sort of CRON that fires. WordPress handles uploads immediately, there is no latency, queues, or cron unless you introduce one yourself. The image appears in the media … Read more

Extract url of every image in library?

First you have to get all attachments. You can use get_posts function for this: $attachments = get_posts( array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ) ); Then you have to loop through them and get their urls using wp_get_attachment_url: foreach ( $attachments as $att ) { echo wp_get_attachment_url( $att->ID ); }

Images are displaying as blank images

You should generate the attachment metadata such as width and height — and file path, and also thumbnails, after you created the attachment: Using wp_generate_attachment_metadata(): $attach_id = wp_insert_attachment( $attachment, $filename ); if ( $attach_id ) { require_once ABSPATH . ‘wp-admin/includes/image.php’; $metadata = wp_generate_attachment_metadata( $attach_id, $filename ); wp_update_attachment_metadata( $attach_id, $metadata ); } Using wp_maybe_generate_attachment_metadata(): $attach_id = … Read more

How can I delete duplicate `*-1.jpg` images?

If you want to delete files from the Media Library, then you need to delete both the database entry (attachment post) and the actual file (files to be more precise as there might be one or more scaled versions of the same image file depending on your setup). You can do these both actions for … Read more

Adding Alt Tag and Dimensions columns to Media Library

You don’t have to create a new function each time you add a new admin column. You can use below functions to show both your media data in separate admin columns. function column_id($columns) { $columns[‘media_alt’] = __(‘Alt’); $columns[‘media_dimensions’] = __(‘Dimensions’); return $columns; } add_filter( ‘manage_media_columns’, ‘column_id’ ); function column_id_row($columnName, $columnID){ if ( $columnName == ‘media_alt’) … Read more