Image upload via FTP to wordpress media library

You can upload your images to your host, and then use media_sideload_image() to upload each file. Let’s assume you upload all of your images to a folder named wpse, in the root of your WordPress installation: // Set the directory $dir = ABSPATH .’/wpse’; // Define the file type $images = glob($directory . “*.jpg”); // … Read more

Rest API rename media

After much digging, it doesn’t seem to be possible. I did craft some automation with a Node script that basically does this: Check if the name is correct. If it’s not, then download the image, upload with a new name and update the product. If everything goes smooth, delete the original image. Same is repeated … Read more

Show ids of displayed media library items

Actually, wordpress stores the media library files also as a post format. so you can follow this way to get your attachment media file and their id’s. Hope this will help you. function get_images_from_media_library() { $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ =>’image’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ => 5, ‘orderby’ => ‘rand’ ); $query_images = … Read more

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