Articles of uploads

Uploading new version of theme fails, folder already exists

I developed a theme for my site. When I make changes, I simply change the version number from 1.0 to 1.2, etc. I zip the files inside a folder called tamaltheme and upload using the theme uploader. This message pops up: Unpacking the package… Installing the theme… Destination folder already exists. …public/wp-content/themes/tamaltheme/ When I don’t […]

Get audio metadata on file upload

I am trying to fetch all audio metadata when I upload a file. This all happens in a plugin, and I currently use the add_attachment action to trigger my custom function : // link add_action( ‘add_attachment’, ‘add_metadata’ ); // Definition public function get_metadata( $post_ID ) { $post = get_post( $post_ID ); var_dump( $post ); var_dump( […]

Cleaning a filename after image sideloading a url that contains `%20`

Right now I’m creating a plugin to sideload images from an external source. The UI allows me to select files on the external server then downloads them via AJAX & media_sideload_image. Everything is working great. After the images is loaded I clean up the attachment’s title by replacing the dashes and underscores with spaces in […]

Get URL of Featured Image After wp_insert_post()

I want to get the url of a featured image. I’ve created a function with wp_insert_post to post data and set a featured image for them. Everything works fine except displaying the url of featured image. Here is my code : $newpostname = $movie[‘title’]; global $wpdb; $id_ofpost_name = $wpdb->get_var( “SELECT ID FROM $wpdb->posts WHERE post_name […]

WordPress HTTP Error on File upload

I have increased the max_file_upload_size from 20 MB to 100 MB in WordPress, but I’ve been facing a problem since then. Whenever I try to upload a file of any type, it says “HTTP Error” when I use the multiple file uploader. I’ve tried to upload using the single file uploader. It says “Error saving […]

Upload and attach to a post multiple image files

In a front end form I have a ‘multiple’ input field for uploading and attaching images to a post and a processing script (from here). I expect that will be uploaded and attached all files that I have selected, but this doesn’t happens. Is uploaded and attached only the last selected file (in alphabetical order). […]

limit media upload to once a day

Is there a way (with hook or plugin) to limit media upload to once a day per user? I can only find related articles about limit file size. Edit: The reason I want to use this is I’m setting up a social site where people share images. I’m seeing an increase in data usage and […]

Media Upload not working after hiding some elements from functions.php

I have put the below code in functions.php. (It’s used to hide some options from client.) But the problem is, after adding these codes, images are not uploading, can’t even even uploaded photos from library or while creating a new post. Someone pls help echo ‘<style> #toplevel_page_wpcf7, #wp-admin-bar-wp-logo, #screen-meta-links, #menu-tools, #wp-admin-bar-wpseo-menu, #footer-upgrade, #toplevel_page_wpfront-user-role-editor-all-roles,#toplevel_page_vc-general, #menu-settings,#toplevel_page_wpseo_dashboard, #toplevel_page_revslider, […]

How to submit/upload data to database and in specific folder?

I am trying to make video plugin. Want to submit data to move the file in a folder which is in the plugin_name folder. To submit/upload I am trying the ‘plugin_dir_path()’ function. And it is not working. Just showing in browser that “uploading %”. But neither it is moving to the folder nor updating the […]

get_attached_file returns wrong path after changing media upload dir

I’ve changed the default WordPress media upload dir ( to ( Everything is OK and media files are uploading and showing correctly. But when I use get_attached_file function to get the path of the file (e.g., it returns the wrong path ( in this case: home/username/public_html/wp-content/uploads/hello.jpg). So when I call the file_get_contents with this […]