How to move wp-content (or uploads) outside of the WordPress directory

You have to define WP_CONTENT_DIR and WP_CONTENT_URL: const WP_CONTENT_DIR = ‘/path/to/new/directory’; const WP_CONTENT_URL = ‘http://content.wp’; The new path must be accessible for read and write operation from the WordPress core directory. You might need a helper function to add the new directory path to the open_basedir list: /** * Add a new directory to the … Read more

How to get the image EXIF date/time and use it for the WP post date/time

PHP has a function for this purpose: exif_read_data I used this image for testing. Try this code for your purpose: add_action( ‘add_attachment’, ‘create_post_from_image’ ); function create_post_from_image( $id ) { if ( wp_attachment_is_image( $id ) ) { $image = get_post( $id ); // Get image height/width for auto inserting the image later @list( $width, $height ) … Read more

Change WordPress upload path and URL

I went to the wp-admin/options.php page and set … But is that how it’s supposed to be done? Nope. You should never change anything in the WordPress core files because all your changes will be lost during the next update. You should use actions and filters instead: add_filter( ‘pre_option_upload_path’, function( $upload_path ) { return ‘/path/to/static’; … Read more

How to add more upload directories?

The following code will change the upload directory for a specific post-type! Just be sure to swap out both instances of “post-type” (line 14) with the name of your custom post-type. /** * Change Upload Directory for Custom Post-Type * * This will change the upload directory for a custom post-type. Attachments will * now … Read more

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