Image resize with image url

u can use this: function wpse128538_resize($url, $width, $height = null, $crop = null, $single = true) { //validate inputs if (!$url OR !$width) return false; //define upload path & dir $upload_info = wp_upload_dir(); $upload_dir = $upload_info[‘basedir’]; $upload_url = $upload_info[‘baseurl’]; //check if $img_url is local if (strpos($url, $upload_url) === false) return false; //define path of image … Read more

Filter Media Library by author or post_parent

The only way to do it is using a query filter I think function wpse156319_posts_where( $where, $query ) { global $wpdb; $where .= $wpdb->prepare( ‘ AND (‘ . $wpdb->posts . ‘.post_parent = %s OR ‘ . $wpdb->posts . ‘.post_author = %s)’, $_POST[‘id’], get_current_user_id() ); return $where; } which you just add in the ajax_query_attachments_args instead … Read more

Apply image width to tag

I am assuming you want this value on the front-end as opposed to needing it in the block editor due to the <figure> somehow not displaying correctly when viewed in the block editor. If that is the case then you can use something similar to DOMDocument as per the following example: Assume HTML of: <div> … Read more

Disable WordPress Big Image Size Scaling

I have the same issue with not being able to turn off big_image_size_threshold (one of the worst new features WordPress has ever put out) for kicks I tried removing the quotes around return false but it doesn’t resolve the issue. The example in Codex does in fact show quotes. https://codex.wordpress.org/Function_Reference/_return_false I have opened a ticket … Read more

Programatically creating image attachments from local URLs and setting featured image

Answers: Is post_guid the image location reference? Or is the path to the image stored somewhere else? $post->guid is the record in a post which holds the URL for your attachment. Where is featured image set? featured image is saved as post meta so use update_post_meta() once you have the attachment id: update_post_meta( $post->ID, ‘_thumbnail_id’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)