Set (featured) thumbnail for post?

Perhaps use set_post_thumbnail()? (Codex ref.) EDIT To get the attachment ID using the Post ID: // Associative array of attachments, as $attachment_id => $attachment $attachments = get_children( array(‘post_parent’ => $post->ID, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order ID’) ); $attachment = $attachments[0]; // ID of your single, … Read more

Open the attachment details modal

Unfortunately the logic of the attachment details isn’t made to be used standalone – it requires the grid that opens it. You can however use the get_media_item( attachment_id ) method to receive the HTML of the form for modifying images: https://developer.wordpress.org/reference/functions/get_media_item/

How to change _wp_attachment_metadata specific value in SQL?

You could do this via PHP instead of SQL, just get the existing metadata and change what you need to, it will handling the serializing for you: $newwidth=”250″; // or whatever it is $attachments = get_posts(array(‘post_type’=>’attachment’); foreach ($attachments as $attachment) { $id = $attachment->ID; $metadata = wp_get_attachment_metadata($id); $metadata[‘width’] = $newwidth; wp_update_attachment_metadata($id,$metadata); } But really, you … Read more

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