Setting a post’s featured image from an embedded YouTube video

Not natively. You’d have to write some code to make it happen – there’s a nice pastebin function that provide the necessary code to do it. Edit (12/19/2011): Yep here’s how you can do this programmatically. Add the following two functions to your functions.php file and you should be good to go. The code has … Read more

How do you remove hard coded thumbnail image dimensions?

Related: Filter to remove image dimension attributes? There’s a filter on post_thumbnail_html which receives as its argument the full html element representing the post thumbnail image before it’s echoed to the page. You can filter out the dimensions with a bit of regex: add_filter( ‘post_thumbnail_html’, ‘remove_thumbnail_dimensions’, 10, 3 ); function remove_thumbnail_dimensions( $html, $post_id, $post_image_id ) … Read more

How to set featured image to custom post from outside programmatically

Can’t this simply be done with media_sideload_image() ? Seems pretty simple. Only catch is if you aren’t on admin area, you must include some libraries from within WordPress includes: // only need these if performing outside of admin environment require_once(ABSPATH . ‘wp-admin/includes/media.php’); require_once(ABSPATH . ‘wp-admin/includes/file.php’); require_once(ABSPATH . ‘wp-admin/includes/image.php’); // example image $image=”http://example.com/logo.png”; // magic sideload … Read more

How to retrieve image from URL and set as featured image/post thumbnail

My favorite way of handling this problem has been to use a little documented function I discovered on another stack post: media_sideload_image It works by fetching an image url to the WordPress upload dir and then associating the image to a post’s attachments. You can try it like so: // required libraries for media_sideload_image require_once(ABSPATH … Read more

How to disable WordPress from creating thumbnails?

To built on Max Yudin’s answer you should use the intermediate_image_sizes_advanced filter, and not image_size_names_choose. Add to functions.php function add_image_insert_override($sizes){ unset( $sizes[‘thumbnail’]); unset( $sizes[‘medium’]); unset( $sizes[‘large’]); return $sizes; } add_filter(‘intermediate_image_sizes_advanced’, ‘add_image_insert_override’ ); Another easier option I think works is going to your Settings–>Media and setting each box for width and height to 0

How to Fix HTTP Error When Uploading Images?

I put the following code into my functions.php file. It works! add_filter( ‘wp_image_editors’, ‘change_graphic_lib’ ); function change_graphic_lib($array) { return array( ‘WP_Image_Editor_GD’, ‘WP_Image_Editor_Imagick’ ); } When this helps it is because it changes the PHP code module used for processing the uploaded image for use with WordPress. This processing includes moving the image into the media … Read more

How do I get image url only on the_post_thumbnail

You might also try: If you only have one size thumbnail: $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ) ); Or…if you have multiple sizes: $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), “size” ); Note that wp_get_attachment_image_src() returns an array: url, width, height, is_intermediate. So if you just want only the image url: echo $thumbnail[0]; Resources: http://wpcanyon.com/tipsandtricks/get-the-src-attribute-from-wordpress-post-thumbnail/ https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/