Articles of uploads

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 […]

Send media uploads to different directories

I am making a website for my local primary school, and I have each class page as a separate page template. Rather than have all their uploads go into the general /uploads/ folder I’d like to direct uploads to certain folders based on their page template, so that page-class1.php media uploads will always go to […]

How to get the filename from file system and create a download link?

I have a custom page template. This template have a custom form, the user can upload a file in that form and input his/her personal infos. The file will save in the file system. I want to create a download link for each file and display it to a table row with the other values […]

How to adapt upload_dir to save files outside of WP uploads folder

We have a CPT which is used to manage various assets including image, pdf, CAD and other files. Our client would like to keep these asset files seperate from their other media files and does NOT want them to appear in the WP media panel. We have found this useful snippet which allows us to […]