wp cli media commands not working

Media is the post type (post_type=”attachment”), so most operations are done with wp post command. By default, wp post manage blog posts (post_type=”post”), therefore by fetching post IDs you must add –post_type=attachment indicating the type of posts. And to update media meta you should use wp post meta update <id> <key> <value> Your entire command … Read more

How do I restore attachment from files in wp-upload

Yes, you can do this. First set up a loop that loops through all the images in the upload directory. Then construct an array with the required data needed to create a new post of the type attachment: $dir = new DirectoryIterator(wp_upload_dir()[0]); foreach ($dir as $maybeFile) { if ($maybeFile->isFile()) { $filename = $maybeFile->getPathname(); $wp_filetype = … Read more

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