How to change the text of the “You are about to permanently delete these items…” alert message when deleting media from the media library?

You could use the gettext filter. See the examples here https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext. In your filter you will add code to check IF it’s the exact text you want to change then if the users meta value is what you are looking for the return the revised text. Else return the passed text unchanged.

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

Programatically upload a file to be stored inside blob field in database, NOT on filesystem

After some further experimenting and talking to a colleague, we found the answer (team effort!) altering how the file handler deals with the file content. // Assign values required $wx_fileName = $_FILES[‘file’][‘name’][$i]; $wx_fileMime = $_FILES[‘file’][‘type’][$i]; $wx_fileSize = $_FILES[‘file’][‘size’][$i]; $wx_tmpf = $_FILES[‘file’][‘tmp_name’][$i]; //$wx_file = fopen($_FILES[‘file’][‘tmp_name’][$i], “rb”); $wx_file = base64_encode(file_get_contents($_FILES[‘file’][‘tmp_name’][$i])); Basically replacing fopen() with file_get_contents() and base64 … Read more