Save image as featured image
Save image as featured image
Save image as featured image
ok, following the comments: //from https://stackoverflow.com/questions/37537577/wordpress-query-by-attachment-meta-image-size add_filter(‘wp_generate_attachment_metadata’, ‘add_metac’, 10, 2); function add_metac($meta, $id){ update_post_meta($id, ‘height’, (int) $meta[‘height’]); update_post_meta($id, ‘width’, (int) $meta[‘width’]); update_post_meta($id, ‘ratio’, round ($meta[‘width’] / $meta[‘height’] , 2 )); return $meta; } at this point you will have, for the newly uploaded images, in the postmeta table all the information and a ratio >1 … Read more
This code works, although I suspect that it could be more efficient – or replaced by a better filter. I modified this code from the answer to this question, which was the best choice out of all the googles I spent hours trying out.enter link description here You will need to change the ‘full’ to … Read more
your query looks good and seems workning. I’ve made a test on my database and the image remained visible in the media library after the ID change. Maybe there was already other posts existing with that IDs
Not all featured image sizes available in Rest API
Extend core block attributes in post content
Try something like that The reverse of this: https://wordpress.stackexchange.com/a/209714/180599 <?php global $wpdb; //The reverse of this: https://wordpress.stackexchange.com/a/209714/180599 $supported_mimes = array( ‘image/jpeg’, ‘image/gif’, ‘image/png’, ‘image/bmp’, ‘image/tiff’, ‘image/x-icon’ ); $all_mimes = get_allowed_mime_types(); $accepted_mimes = array_diff($supported_mimes, $all_mimes); //and… $keyword = stripslashes($_REQUEST[‘keyword’]); //$search = $wpdb->get_col( $wpdb->prepare( ” SELECT DISTINCT ID FROM {$wpdb->posts} WHERE post_title=”%s” OR post_content=”%s” “, $keyword, $keyword … Read more
The answer was quite simple … just be sure that the height and width are set inside the svg code, like: <svg height=”100″ viewBox=”0 0 50 50″ width=”100″>
Change the RSS feed image
Set Custom Image Size Just For Specific Custom Post Type