copy attachment title to description and alt text

You can make a query to loop through all the attachments, and then update the attachment info for each attachment in the while loop. Something like $args = array( ‘post_type’ => ‘attachments’, ‘post_status’ => ‘any’, ‘posts_per_page’ => -1, ) $query = new WP_Query($args) if($query->have_posts()): while($query->have_posts()): $query->the_post(); // 1. Get the attachment filename here and store … Read more

How to select featured images for 1500 posts?

You can run a script that will programmatically set the featured image for each post. You can use the first attached image for this. To get the attached images run a query for the posts and loop through each one and use get_children() setting the post_parent to the current post id in your loop. $posts … Read more

How do I get gallery thumbnail URL and change the default thumbnail size?

The thumbnail size is based on the dimensions defined in WordPress Dashboard > Settings > Media, unless your theme overrides it. how can I make my theme override it? To change default post-thumbnail size, you need to use set_post_thumbnail_size. Add this in your functions.php file: if ( function_exists( ‘add_theme_support’ ) ) { add_theme_support( ‘post-thumbnails’ ); … Read more

Unattaching images from a post

This can be done using an Ajax call that will query the database and set the parent as “zero”. First, create a meta box, enqueue the Javascript that calls the unattach function and register this WP_Ajax function. <?php /* Plugin Name: Unattach Meta Box Version: 0.3 Author: brasofilo Plugin URI: http://wordpress.stackexchange.com/q/54822 */ add_action( ‘add_meta_boxes’, ‘wpse_54822_add_custom_box’ … Read more