All Questions
1,114 questions with no upvoted or accepted answers
2
votes
0
answers
126
views
How to rename image at uploading on specific plugin or post-type in WordPress
I am working on a plugin. In plugin, there is a custom media uploader. All images upload successfully.
Then I want that when I upload images its renamed, so i get this code and write it in my plugin ...
2
votes
0
answers
2k
views
Button inside Custom Meta Box triggering the Update Button
I have a custom meta button that adds additional custom meta fields inside the custom meta box.
This meta box, in particular, gives me a choice to enter a particular skill and rate my own ...
2
votes
1
answer
489
views
WP Media uploader loading only once in options page
A weird issue happening with me which I am unable to fix. In my theme options page, I added options to upload images one for logo and another for backgroud image. Here is my HTML
<table class="...
2
votes
1
answer
367
views
wp_upload_bits Upload Specific Sizes Only
For images uploaded using this code, I want to only upload the full-size image and the thumbnail (whereas for images uploaded through site, I want all sizes). However, I can't figure out how to make ...
2
votes
0
answers
375
views
Admin Dashboard with Custom Tab for Client
I am trying to create a basic Tour Date widget.
When the user clicks on the Tour Date Tab from the admin dashboard I want them to be presented with five fields.
Date
Venue
City, State or Country
...
2
votes
0
answers
679
views
Sharing a common set of image files for media library, across all sites within multisite
In mutisite, the uploads directory structure looks like this:
/wp-content/uploads/sites/1/
/2/
/3/
Each number is the id of the site within the ...
2
votes
1
answer
225
views
Can't seem to upload a file to a custom directory
I am trying to do something extremely simple.
I just want to save a file, in a custom wordpress upload directory inside of the media library.
But it just won't work.
I've tried the solution here, ...
2
votes
0
answers
2k
views
AJAX image upload with a upload progress bar using media_handle_upload
I currently have post image upload for the featured image from front-end form.
<input type="file" name="wh_image_upload" id="wh_image_upload" multiple="false" />
and using media_handle_upload ...
2
votes
2
answers
5k
views
How To install AWS SDK for PHP in wordpress?
I am going to install and use AWS SDK for PHP to facilitate uploads/list objects directly from the front-end of my WordPress instance to S3. What is the best practice to do that ?
P.S: I don't want ...
2
votes
0
answers
824
views
wp_editor in metabox not working
So, I've created a meta box within my page to allow my client to be able to add content into multiple different content blocks dynamically. I've done that using the wp_editor function like so.
...
2
votes
0
answers
1k
views
How to delete uploads not in media library?
How to delete uploads not in media library? I have lot of images in my uploads folder but doesn't in media library. Exist some method how this do it?
2
votes
1
answer
554
views
Different upload path per file type
I want to have two different paths for different files.
For example, I have all .zip and image files all in the same locations.
What I am wanting to the have images in one path (eg. wp-content/...
2
votes
0
answers
193
views
wp.media add context
I have wp.media frame on my plugin to upload doc, docx file. I am filtering the uploaded file.
If uploaded other than supported file, it will display this error
I am filtering it at ...
2
votes
0
answers
69
views
Add fields to the WordPress media uploader
I am trying to add an URL field to the WordPress media uploader using following code:
/**
* Add an URL field to gallery attachments
*
* @param $form_fields array, fields to include in attachment ...
2
votes
0
answers
166
views
Edit single attachment on click (WP-admin)
I've created a custom media manager for a CPT I've created. I have everything functioning properly except an edit function. I want to have an edit button for each attachment that gets added to the ...
2
votes
1
answer
81
views
Organizing media uploads
One of my clients wants to transfer his WordPress website to my server. The problem is his website doesn't use sub-folders in his upload folder, and he has more than 1,000,000 files in the root of his ...
2
votes
0
answers
419
views
Refreshing collections in the admin media manager
I know this question is very similar to this previously asked question; however, I was wondering if there was a more up-to-date/official way to refresh content programmatically in the WordPress admin ...
2
votes
1
answer
1k
views
How to get profile user id when uploading image via media uploader on profile page
I have a PlugIn which lets a user upload an image to a user profile in the backend. Now I want to access the user id in the uploader to change the filename of the uploaded image.
On the user profile ...
2
votes
0
answers
2k
views
How to resize image on client-side before upload?
I've been using Plupload to resize images on the client side before uploading them to the server. I've implemented a front-end form which lets the user select a file from their computer and submit it. ...
2
votes
0
answers
671
views
adding checkbox to meta
I have a custom post type that is working well and displaying/saving all the text fields. The issue is now I need to add 4 check boxes but not sure how to do that. Any ideas?
function fitter_info() {
...
2
votes
0
answers
197
views
Change default uploads file using wp Skeleton
I am using Wordpress Skeleton (https://github.com/markjaquith/WordPress-Skeleton) which pulls the themes etc out of the wp directory. I am trying to set it up so uploads have a custom url (eg: site....
2
votes
0
answers
1k
views
capability for upload on front-end (An error occurred in the upload. Please try again later )
We have a front-end form with wp-editor on front-end template page.
Everything is working fine. but the only problem is "we can't add new images on front end form". there is an error "An error ...
2
votes
0
answers
1k
views
Animated Gif image not uploading correctly
Started today, I tried many times to upload a gif image and inserted it.
Wordpress gives this
But when I checked media library, I found it there attached with a post.
These are error logs:
[Mon ...
2
votes
1
answer
1k
views
Adding wp_enqueue_media(); causes problem
I want to add the media uploader in the theme options page. If I add following code in the options page, the media uploader works fine there, but it creates problem in the standard posts featured ...
2
votes
0
answers
1k
views
Pass parameter to the upload_dir filter
I'm trying to figure out a better way to pass a parameter to the function I am using with the upload_dir filter. Currently I have only gotten it to work by using sessions and/or cookie that I erase ...
2
votes
1
answer
253
views
Hide upload image fields for the different media upload popups
I am trying to change a few of the options in the Set Featured Image popup in the Wordpress admin. I can't seem to find anything that determines if the popup window is a Featured Image or an Add Media ...
2
votes
1
answer
130
views
Images in upload folder with hexadecimal names
I'm using Wordpress 3.4.1 with the Suffusion theme 4.3.0.
I've noticed that there are a large number of images with hexadecimal names, like 54f96e1d5f478186f66bde9d6aeda625.jpeg. I'm wondering how ...
2
votes
0
answers
433
views
WPAlchemy: How to output values?
I am using http://www.farinspace.com/wpalchemy-metabox/ and have created my meta boxes and the data is being saved successfully (See below) but I don't know how to output these 'ingredients' on the ...
2
votes
1
answer
1k
views
Best choice of options/settings framework for plugin/theme development
My question is what is the best options/settings framework out there now to safely build custom plugin/theme upon? I found the similar question here, but it was asked 7 years ago and definitely, ...
1
vote
0
answers
38
views
Removing custom physical folders with rmdir
Need help with WordPress to remove custom physical folders.
I am developing a WordPress plugin to use custom physical folders in the Media Library. The functionalty of the 1st version is quite basic: ...
1
vote
0
answers
22
views
How to revert the media structure from /uploads/year/month to the /uploads directory in wordpress?
I tried to use wp-cli using regex like this:
wp search-replace 'uploads/[0-9]+/[0-9]+/' 'uploads/' --all-tables --regex
but in this case there is a problem with possibly repeated file names and ...
1
vote
1
answer
454
views
Convert base64 string to WordPress attachment uploads multiple images instead of a single one
I'm trying to convert a base64 string to an image file and upload it into WordPress media library.
It seems like the code is working, but, for some reason, every time I call this function it uploads ...
1
vote
1
answer
102
views
Different upload file size limits based on file type
I would like to put a different limitation on uploading content in the media library ( depending on file size and file type)
For example :
Upload mp4 (allow maximum upload file size 64mo)
Upload pdf (...
1
vote
1
answer
117
views
How can I get all attachments by a user on a WP multisite network?
I'm creating a front-end based project where users can make posts and add images to them. It's a network of sites that users have access to.
For a better user experience, I want users to be able to ...
1
vote
0
answers
57
views
Problem with "is_user_logged_in()" and woocommerce (Code for custom media upload for each author.)
I'm sorry for my english...
I am using the following code to create separate media directories for each author..
( Thanks to https://wordpress.stackexchange.com/a/400352/220907 )
function ...
1
vote
0
answers
38
views
Post meta box data not saving
The meta box, fields, etc. are all displaying correctly but when I go to update the page it seems the data in those boxes has not saved. Any ideas? Using a custom post type called 'question'. Would be ...
1
vote
3
answers
3k
views
Can't upload svg files in WordPress
I am facing the following issue while uploading any SVG file and sometimes face the same issue while uploading any image. "The server cannot process the image. This can happen if the server is ...
1
vote
0
answers
55
views
upload image to wordpress media library failed for custom post type
image upload failed. I tried to upload gym logo as thumbnail image for gym post type. All the form elements are working. But image upload is not working. images are not appearing in WordPress media ...
1
vote
0
answers
127
views
Saving multiple custom meta box fields
So,
I have a custom metabox, with multiple fields on it, and the amount of boxes is variable (could be 3, could be a lot more, depending on order quantity number)
I'm trying to write a save function ...
1
vote
0
answers
29
views
How to connect WordPress media to another host?
I have uploaded about 1000 PDF files in the media section of the WordPress site, how can I transfer the files to another host and change the links of the files in the content of the site?
the second ...
1
vote
0
answers
143
views
How to get meta box labels?
I know how to add a meta box, and I know how to retrieve meta box values. That's not what I need; I just want to clarify that first. What I need is to get meta box labels by id.
I am adding links to ...
1
vote
0
answers
51
views
Retroactively change Permalinks for media files after disabling year/month format
Disabling "Organize my uploads into month- and year-based folders" works as expected for new files uploaded. What I have not been able to find is if there is a way to also "move/...
1
vote
0
answers
74
views
I want to customize wp.media (the wordpress admin uploader) in order to change the file name but only in video custom post type
I want to customize the wordpress default admin interface uploader: wp.media.
I already created a custom post type named "video" and I added a wp.media element which permits to upload the ...
1
vote
1
answer
158
views
Generate metadata for cloud images
The current situation
We use the AWS SDK for PHP to store media files on S3 instead of the server's local storage, and use the wp_handle_upload filter to point the inserted attachment to the S3 file ...
1
vote
0
answers
2k
views
wp.media Uncaught TypeError: Cannot read properties of undefined (reading 'state')
Here in a JS class, I used "wp.media" to upload images. I can open the media popup by clicking a button. But getting this error (Uncaught TypeError: Cannot read properties of undefined (...
1
vote
1
answer
36
views
Migration to WP - Couldn't load image
Situation:
I'm trying to migrate static page made with HTML/CSS/JS into Wordpress. The images won't load. They work in HTML, but when I migrate into PHP there are only alt-descriptions visible. Upon ...
1
vote
0
answers
276
views
Offload Media Library to other domain on a different server
How is it possible to change the media storage of Wordpress to a subdomain on a different server. The main domain example.com running on a server pointing to IP 192.168.0.1 and I've created a ...
1
vote
1
answer
339
views
Save / Show multi line text in metabox
In a plugin I have made (Snup Widget) I have made a metabox.
In the sample here I have made two line with text.
When I want to show the text in output in the widget it shows in one line, without break....
1
vote
0
answers
175
views
How to display a warning when an uploaded image is too small?
I want to display a warning when a user uploads an image with too low a resolution. I don't want to block the upload, just give a warning.
The only option I see is wp_handle_upload_prefilter, but ...
1
vote
0
answers
77
views
How to enable sorting in custom media uploader in plugin
In my plugin I need a media uploader exactly like the one you see when you select a post's featured image.
I managed to do almost everything with this code:
media_uploader = window.wp.media({
...