Populate a custom attachment metadata field with data from the image’s EXIF data?

You can hook into the add_attachment and edit_attachment action hooks and use PHP’s exif_read_data() to add the EXIF data to your attachment’s metadata: <?php add_action( ‘add_attachment’, ‘wpse302908_add_exif’ ); add_action( ‘edit_attachment’, ‘wpse302908_add_exif’ ); /** * Inserts metadata from an image’s EXIF data. * * @param int $post_id The attachment’s post ID. * @return void */ function … Read more

What functions of WP_Filesystem allow me to create a file with code-generated contents in a directory?

Seems like you have several misconceptions/misunderstanding about when/why and how you should write to files. In general never write to any directory in which code resides, either core code or themes and plugins code. Those directories might be shared between different wordpress instances, and therefor they are not appropriate to be used for data related … Read more

Website does not reflect changes on live after uploading files via FTP

There is a difference between WordPress files you upload on your FTP, and WordPress “content” that is stored in your database. For your content to be updated, you have to migrate your WordPress database online. Resources: This link explains how you can migrate your WordPress website entirely https://www.wpexplorer.com/migrating-wordpress-website/ For example, has stated by @WebElaine, you … Read more

Upload media (image) and set the category

First of all, if you want to apply categories to Attachments, you have to enable categories for the attachment. You can do this by using the register_taxonomy_for_object_type() function. In your plugin file or theme functions file, add the following: function wp_add_categories_to_attachments() { register_taxonomy_for_object_type( ‘category’, ‘attachment’ ); } add_action( ‘init’ , ‘wp_add_categories_to_attachments’ );

How to share /uploads/ directory with another site on the same server?

Well, what you want to achieve saving uploads in another domain? You want to share the uploads folder with another domain? Did you know you can use more than one domain (site) in a single WordPress Installation? It’s called Multisite: https://premium.wpmudev.org/blog/ultimate-guide-multisite/ To change the upload dir. Just use the filter upload_dir. It’s documented here: https://codex.wordpress.org/Plugin_API/Filter_Reference/upload_dir … Read more

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