All Questions
1,114 questions with no upvoted or accepted answers
5
votes
1
answer
2k
views
How to add image uploader to a custom widget?
I'v built a custom widget that will show some sport scores. Scores are added trough custom post. When i open new custom post(scores) i enter their team names, score, scores. Now i want to add an ...
4
votes
0
answers
442
views
extend Meta Box / Document Panel
For a project, I'm trying to figure out the best way to implement a checkbox, related to a post type.
What I'm trying to to:
On the final website, there should be a dropdown-button, with upcoming ...
4
votes
0
answers
642
views
Retroactively place uploaded media into -month, -year based folders?
I am working on a client's site. It has about 8GB of images in the uploads folder. Unfortunately, from day one, years ago, uploaded media files were not set to be organized into month-, year- based ...
4
votes
0
answers
109
views
Saving WordPress generated thumbnails in a subdirectory
I.e. an uploaded image image.jpg is stored in wp-content/uploads/2016. WordPress will generate thumbnails named image-150x150.jpg, image-300x300.jpg, and image-1024x1024.jpg in the same directory.
Is ...
4
votes
1
answer
2k
views
Add custom buttons with custom actions in Edit Post screen in WordPress?
I am creating something for a client and I have a Class that I created with a Custom Post Type called 'PuSH Feeds' and when the user adds a new post and publishes it they can then click on one of two ...
4
votes
0
answers
609
views
How to reload a select box of posts dynamically?
I'm using custom meta boxes for a project. I have created a custom taxonomy (select box) and I have another select box populated with Posts. I need to only load the posts based on the selection of the ...
3
votes
1
answer
113
views
WordPress Permissions Issue for Media Library / uploading
I've got some issues with file permissions which I'm trying to resolve...
I have two sites and they both have the same permissions as far as I can tell but for some reason one site can upload files / ...
3
votes
1
answer
794
views
How do I display a PDF thumbnail as a link to the PDF without uploading the image
When I found a couple of years ago that WordPress will create thumbnails of uploaded PDFs, I was so happy, thinking I wouldn't have to make and upload separate PDF cover images to have a thumbnail ...
3
votes
1
answer
1k
views
Create custom tab in WordPress 5 media upload
Can someone help me create custom tab in WordPress media library. With WordPress version 4 i used to media_upload_tabs function to build that nice work. But now, in WordPress version 5 the function is ...
3
votes
1
answer
904
views
Show or hide custom meta box not work with Gutenberg
I’m on WordPress 5 beta 4,
the problem is that meta boxes can not hide them when selecting a specific template chosen by page attributes.
To make them appear or hide, you have to update the browser ...
3
votes
1
answer
923
views
Image upload via FTP to wordpress media library
Is there any permanant way to upload images via FTP to WordPress media library other than the available plugins which don't really work well most of the time? I would really appreciate if anyone ...
3
votes
1
answer
161
views
How to upload images from my directory into my wordpress?
I'm doing a paste the link onto input and then uses PHP(imagecrop) to crop and store the image onto server directory.
$imagesrc = $_GET['img'];
$img = file_get_contents($imagesrc);
$im = ...
3
votes
0
answers
173
views
How to add multiple mime with same suffix in wordpress?
I'm having problem adding archive files to wordpress.
The original $allowed_mime_type is using application/zip, while there are other mime type of .zip like application/x-zip-compressed, application/...
3
votes
0
answers
42
views
How do I add custom_meta_box_id's value?
I have added custom meta boxes in post and I want to put Tag slug name in the meta box text field, and want to display the text field's texts (Tag slug name) like following this.
<?php
$my_query =...
3
votes
0
answers
65
views
Render Selected Categories in Admin Edit Post Screen differently
Selected Categories for a post in the admin screen are rendered by:
// Put checked cats on top
$output .= call_user_func_array( array( $walker, 'walk' ),
array( $checked_categories, 0, $args ) );
...
3
votes
0
answers
594
views
Media upload via backend doen't work after moving site
I have copied my site to a subdirectory for test purposes, everything works fine now. The only problem I have seen so far is the Media upload. When I try to upload a file I get a:
Unable to create ...
3
votes
0
answers
191
views
How to create a repeatable / reusable divs in the metabox?
I have a meta box:
<?php
function custom_meta_box_markup() {
global $post;
$meta_box_text = get_post_meta( $post->ID, 'meta-box-text', true );
$meta_box_text_day = get_post_meta( $...
3
votes
1
answer
1k
views
How to disable drag-and-drop upload function in Media Library?
Does any one knows a valid/standard way to disable drag and upload when accessing the media library in the admin area? In order to make this sense to you, I'm building a multisite and user of sub-site ...
3
votes
0
answers
2k
views
How to add meta boxes(repeater fields) from WordPress back end?
I have a custom post type 'service'. Each service will have items. For each item there would be 'name of item' and 'price'. Earlier i created meta boxes for 5 items i.e 10 meta boxes in total, which i ...
3
votes
3
answers
2k
views
Retrieving JSON data in ajax request from media uploader
I'm having some problems getting my JSON data that's being passed via an ajax request.
I'm trying to implement the media uploader into a plugins settings page. I've got it functioning properly using ...
3
votes
0
answers
2k
views
Changing image URLs in media library
On a default wordpress install, the media library is located at:
/wp-admin/upload.php. I am trying to update the image URL to point to my CDN, not my local server.
This filter
add_filter('...
3
votes
2
answers
6k
views
Displaying Meta Box Image
I have some problems displaying info from my custom meta box in my custom post type single. I'm using Reusable Custom Wordpress Meta Boxes by Tammy Hart.
I'm able to display the textfields using this:...
3
votes
1
answer
1k
views
Organizing uploaded media with wp_insert_post() and wp_handle_upload according to time parameter
I'm retroactively creating a post with wp_insert_post() and attaching a featuring image to it. I need the image to go into the folder that corresponds to the post's publishing date.
I'm using time ...
3
votes
1
answer
863
views
HTTP Error when uploading images
I am getting an 'HTTP Error' when uploading images to posts. What could be the reason for this? It doesn't happen all the time, sometimes I get the error, try again, and the file uploads. Actually the ...
3
votes
1
answer
550
views
Display Single Attachment Image file size, uploaded date, resolution, file-name etc in Sidebar
Sorry for any wrong details. I am totally new to WordPress development. I am running a photo site. On single attachment page, I want to show the details (i.e upload date, filename, size, resolution) ...
2
votes
0
answers
36
views
I can't see all images in my media library - How Can I reset the index of that library?
When I load my media library (either through the media tab on the left or editing posts/pages and adding images in that interface) it shows that I have 1206 images in my site. However when I click ...
2
votes
0
answers
138
views
Wordpress auto generates small medium and large of an image on upload, how can we guess their links?
WordPress out of the box has an integrated image sizes system, which creates files ( thumbnail, S, M, L) but in the media library, it only shows one original file size link.
Let's say, I upload a file ...
2
votes
0
answers
129
views
Regenerate thumbnails unexpected resolution (96 x 96)
I'm using WP CLI wp media regenerate to resize my thumbnails.
I've noticed something a bit weird. The original image I upload is a JPEG with a resolution (DPI) of 72. The images that are generated ...
2
votes
0
answers
766
views
Update image via WP REST API
So I wonder if its possible to update images in the media library via the REST AP? Ive seen a github issue back in 2016 where its mentioned this its not supported in the REST API. Is this still the ...
2
votes
0
answers
26
views
Is 700,00 jpgs too many for a WordPress site.?
I am helping a customer with a website( uses WordPress ) that is very slow to load and sometimes times out or does not respond.
I notice they have 692,264 jpgs in /home/xxxx/public_html/wp-content/...
2
votes
0
answers
577
views
REST API: upload media with advanced custom fields (ACF)
Aim
I am trying to upload media via the REST API. I have successfully got it working, except for with the ACF data.
Problem
The media uploads successfully, but the acf fields are blank.
Code
const ...
2
votes
0
answers
656
views
How to change upload directory based on frontend form input name or ID?
I created a frontend form using a plugin which allows logged in users to create draft posts. There are 3 file upload areas. I need 1 of them to use the default public WP media upload folder as usual. ...
2
votes
0
answers
161
views
How to host different file formats/types for a media attachment without creating multiple attachments?
For a better browser compatibility we often have to maintain multiple format of a media.
For example:
Image - JPG & WebP
Image animated - GIF & WebP
Image transparent - PNG & WebP
Video - ...
2
votes
0
answers
855
views
A better way to add a meta box to custom post types
Id like to customize the UI for adding and editing a custom post type such that each custom field is included as a separate input field on the "new post" and "edit post" forms (as ...
2
votes
0
answers
295
views
wp_generate_attachment_metadata generates 503 Service Unavailable or 500 timeout errors
I've been struggling for a week with this...
I was trying to upload an image with media_handle_upload but it never worked (it always timed out), so I decided to break it down to see where it failed ...
2
votes
1
answer
466
views
Syncing Avatars across multisite
There's gotta be a way. I have tried a bunch of different multisite sync plugins and they sync users and roles just fine (even paid for plugins to do so)....but avatars don't sync.
My registration ...
2
votes
0
answers
52
views
Media Library does not show the uploaded image
I am using a custom form to upload image and trying to move the file in the Media Library. The wp_insert_attachment() is working fine because I get the attachment id; however I don't see the image ...
2
votes
0
answers
49
views
How to re-arrange media uploaded using : media_handle_upload() as per year / month
I have been facing this issue that all the new media files are getting uploaded to single folder which was auto-generated during initial site development.
Now since all new images are getting uploaded ...
2
votes
0
answers
2k
views
move_uploaded_file() not working on wordpress front end
I have working code that uploads an image from the front end and sets it as a featured image and custom field photo for a custom post type but I am unable to figure out how to set the upload path.
...
2
votes
0
answers
127
views
How to have meta boxes save via REST in Gutenberg?
I have a number of meta boxes added to a site I'm building, and would like to have their data saved via the REST API rather than have the post save "twice" in Gutenberg (once via REST for the basics, ...
2
votes
2
answers
1k
views
Adding Meta Boxes while Registering a Post Type in a Class
I am trying to add a few meta boxes for a Custom Post Type through a Class. I am using the "register_meta_box_cb" parameter while registering the Custom Post Type to specify the callback function for ...
2
votes
1
answer
525
views
ACF attachment custom field in rest response
I created an extra select option ACF field for media uploader and I would like to retrieve the associated values in Gutenberg MediaUploader onSelect.
Is there a workaround for this case?
2
votes
0
answers
2k
views
Metabox not show in categories custom post type cmb2
it is possible to add a field in the categories (tags) in taxonomy?
this is my code in functions.php
function post_types(){
register_post_type('products',array(
'labels' =&...
2
votes
1
answer
3k
views
Admin page: form with enctype="multipart/form-data" does not transfer its data
I'm googeling for hours now but can't find anything to my problem:
I'm building a plugin and want to embed a file input in its admin page. For this reason I'm giving the form-element the attribute ...
2
votes
0
answers
625
views
Media library not loading after switching the main site of multisite
I switched the subsite and main site of a multisite. Now, the images are not loading in the media library and posts of the main site. However other subsites are working fine.
The images of the new ...
2
votes
0
answers
53
views
How to stop unlink images when remove a site or user
What's the best way to prevent images deleting?.
I have a central cdn site to share images to several sites on wordpress multisite, and by mistake, I have remove a user from the network and all my ...
2
votes
0
answers
436
views
Multisite media library uploads broken images
I am having an issue with one of my sub-sites media library. All it uploads are broken images. It loads fine locally but for some reason it gives me the error
"Failed to load resource: the server ...
2
votes
0
answers
2k
views
Add a custom field to top attribute in WooCommerce
i kinda went crazy trying to solve this.
I need to add a custom select field (and save it) to WooCommerce Attributes edit / insert new page - in each top level attribute - not the sub "terms"...
...
2
votes
0
answers
225
views
Use WordPress's Media Uploader/ Manager in non WordPress php application
I need a image upload and browse, resize, crop functionalities.
Since it is already built available in wp. I need some idea how can i use it my custom php application Laravel.
Adding the media ...
2
votes
1
answer
463
views
Dynamically adding WYSIWYG to metaboxes
I've created a custom metabox area and need to add the option of multiple metaboxes.
So far I found this guide https://jeremyhixon.com/repeating-wordpress-editor/ which works absolutely perfect up ...