Upload specific images to specific folder

In your answer you said that desired path is something like wp-content\uploads\state-name\destination\ where state-name is a taxonomy term and destination is the slug of one destination CPT. Last thing is not clear from your question, but it seems so, let me know if I’m wrong). So, I suggest you this workflow: Add a destination post … 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

Differentiate Featured Image from Post Images upon Upload

You could do this by filtering the meta value for _thumbnail_id. add_filter( ‘update_post_metadata’, ‘generate_featured_image_sizes’, 10, 5 ); add_filter( ‘add_post_metadata’, ‘generate_featured_image_sizes’, 10, 5 ); function generate_featured_image_sizes( $check, $object_id, $meta_key, $meta_value, $unique_or_prev ) { if ( $meta_key == ‘_thumbnail_id’ ) { // regenerate previous featured image thumbs if it exists if ( false !== ( $prev_thumb_id = … Read more

“Add Media” only shows “Full Size” under Attachment Display Settings

In order to show new image dimension options in the WordPress admin media library you would need to use the image_size_names_choose filter to assign them a name. So the code in your functions.php should look something like this: if ( function_exists( ‘add_image_size’ ) ) { add_image_size( ‘single-post-medium’, 515 ); add_image_size( ‘single-post-small’, 250 ); } add_filter( … Read more

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