wp_generate_attachment_metadata returns empty array

I believe the following is happening here: As @Luke pointed out, wp_insert_attachment() takes an array of post data. The format of the array you are passing to it is not correct. The keys are different. What should be stored as the post_mime_type, is being passed with the key type. Because of this, no mime type … Read more

Modify featured image path to Amazon S3

You can hook into the output and modify the URL there. add_filter( ‘post_thumbnail_html’, ‘my_post_image_html’, 10, 5 ); function my_post_image_html( $html, $post_id, $post_thumbnail_id, $size, $attr ) { $upload_dir = wp_upload_dir(); $base_url = $upload_dir[‘baseurl’]; // Change the default upload directory to AWS Bucket link $AWSBucket=”http://s3.amazonaws.com/bucket”; $html = str_replace($base_url, $AWSBucket, $html); return $html; } Output the image echo … Read more

What might cause a POST to wp-admin/async-upload.php to return JSON >and< HTML?

I had the same issue and did not find any information in my debug output. It worked out, that DOING_AJAX was not defined (I don’t know why). Changing the beginning of async-upload.php from if ( isset( $_REQUEST[‘action’] ) && ‘upload-attachment’ === $_REQUEST[‘action’] ) { define( ‘DOING_AJAX’, true ); } to define( ‘DOING_AJAX’, true ); worked … Read more

Where does wordpress store the FTP credentials?

It doesn’t. WP Filesystem API will ask for FTP credentials, but it will do so for each operation. They aren’t stored persistently. They can be stored persistently by hardcoding into wp-config.php, but WP won’t do that itself, it’s a user action. Note that WP only asks for FTP credentials if it cannot modify files without … Read more

How are the year and month folders added to the uploads directory?

This is how I understand the process: The wp_upload_dir() function is the main control room for the upload folder creation process and the wp_mkdir_p() function is the helpful assistant. Everytime wp_upload_dir() is called, it’s actually running a file_exists() check on the current upload folder, through the wp_mkdir_p() function. If the folder doesn’t exists it’s created … Read more

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