Bulk Image Uploader to create new post from each image [closed]

add_action(‘add_attachment’, ‘create_post’); function create_post( $attach_ID ) { $attachment = get_post( $attach_ID ); $my_post_data = array( ‘post_title’ => $attachment->post_title, ‘post_type’ => ‘post’, ‘post_category’ => array(‘0’), ‘post_status’ => ‘publish’ ); $post_id = wp_insert_post( $my_post_data ); // attach media to post wp_update_post( array( ‘ID’ => $attach_ID, ‘post_parent’ => $post_id, ) ); set_post_thumbnail( $post_id, $attach_ID ); return $attach_ID; }

WordPress Post featured image URL in the header

To answer this one and point to the real problem: As the <head> HTML tag comes far before the actual loop, you’ll need something else than the global $post. get_queried_object(); get_queried_object_id(); The plugin The code is tested and works. As you might want to keep this functionality when switching themes, I’d suggest wrapping it up … Read more

Get image alt attribute just by image URL

Using the function found here, you could add this to your functions.php // retrieves the attachment ID from the file URL function pippin_get_image_id($image_url) { global $wpdb; $attachment = $wpdb->get_col($wpdb->prepare(“SELECT ID FROM $wpdb->posts WHERE guid=’%s’;”, $image_url )); return $attachment[0]; } But to use it, you need the full image URL. $img_url = get_bloginfo(‘url’) . “https://wordpress.stackexchange.com/bc/wp-content/uploads/placeholder-image.png”; if … Read more

Image Quality Thumbnail Compression in WordPress?

(this should be a comment, but my reputation is too low) Setting jpeg_quality will not disable compression because it does not disable processing. JPEGs will be always compressed, and they are almost never lossless, not even at 100 – it does not stand for “100% original quality”. What happens here, is that WordPress’s default image … Read more

Styling images coming from another blog

Calling image_resize() would be difficult, since it would search for the image in your main blog’s upload directory. If it is a fixed image size I would just add it to the configuration of your photoblog, so it is created there when you upload new images (you can then rebuild your old image thumbnails). In … Read more

A way to change image urls in post to cdn image url?

You can parse via regex for images in the_content; but is always load and slowly. Maybe you change the url of images, after post_save in database or change the current posts inside the database and create an custom CDN. Its the fast way and all caching plugins has the break, that she must parse the … Read more