My media items are not stored in YYYY/MM subfolders of uploads. Instead, I had cooked up some scheme to ingest posts, but seem to have declined/neglected to organise them that way. So, I've got a combination of one big uploads folder containing thousands of files, plus some specific subfolders in uploads, like logos, people, icons. That's because not everything is related to a post. But the images that do relate to posts... well, they are disorganised. I think I wish …
Here is the thing. I am using the WP media uploader on the frontend. What I need is to have it behave differently depending on a certain action. I am attaching the media in a specific custom post type single page. This is a small excerpt from my code. I'm using this to trigger the media library. var uploader = wp.media({ title: 'Upload Image', multiple: false }).open() .on('select', function(e){ // Some code here }); Then I am filtering the library …
For a project at my office I have 3 websites ending in ".nl", ".de" and ".com". They all end in the same folder but don't all have the same images and uploads. My folder structure is like this: - / | - wordpress | - wp-content | - uploads | - themes | - plugins | - index.php | - wp-config.php Everything was working fine until I changed the uploads directory for the uploads with this line: const UPLOADS = …
I want to delete all the resized images while leaving the original image. I have more than 20 GB of unused data taking up room on the server. For example: first-image-name.jpg first-image-name-72x72.jpg first-image-name-150x150.jpg first-image-name-250x250.jpg first-image-name-300x300.jpg first-image-name-400x400.jpg first-image-name-1024x1024.jpg second-image-name.jpg second-image-name-72x72.jpg second-image-name-150x150.jpg second-image-name-250x250.jpg second-image-name-300x300.jpg second-image-name-400x400.jpg second-image-name-1024x1024.jpg Is there a way to delete all the resized images and disable creating such ones in the future?
I've started with MarkJ's answer - JavaScript included into the block editor. I wanted to control more attributes for gallery than linkTo — the number of columns, cropping, and image size. wp.domReady( function() { wp.blocks.registerBlockVariation( 'core/gallery', { isDefault: true, attributes: { columns: 6, imageCrop: false, linkTo: 'media', sizeSlug: 'thumbnail', // does NOT work in WP 5.9.3 } } ); }); This snippet does the job partially. In WP editor block settings panel it looks like OK. Unfortunately, in fact the …
To improve user experience, I want to make changes to the image meta fields in the Media Library: As demonstrated above, I want to change the Caption field to Source and remove the Alt Text and Description field. How can I achieve this?
The media library is currently organized by months and years .../uploads/2021/09/. I'd like to go without the months and year and use the url .../uploads/ for future uploads. For consistency, I'd like to move the existing media files to .../uploads/ too What will be a faster way to move the files instead of uploading them? sudo mv gives me the error -bash: /usr/bin/sudo: Argument list too long.
For e.g. I deleted apple.jpg. Image is deleted permanently. After a while, I upload apple.jpg. Wordpress still append -1 to the image name apple-1.jpg. However, apple.jpg is no where to be found. I have not encountered this behaviour with previous versions of Wordpress. What can I do to stop wordpress to append -1 to the deleted image filename? After some search, this seems to be an issue with latest version of wordpress. Files not deleted from server.
There is a button in the frontend on the post page to upload images. How do I display attachments that are attached to this post in the wp.media frame? How to intercept wp.media's AJAX request for attachments to filter attachments by post ID? Here's what I have: function.php add_action('wp_enqueue_scripts','bla_bla'); function bla_bla(){ wp_enqueue_media(); wp_enqueue_script('bla_bla_bla','/script.js','',true); } script.js var wpMedia; var wp_media_post_id = wp.media.model.settings.post.id; // keeping the old post id $('button.upload').on('click',function(event){ // file upload button in post var btn = $(event.target); var postID …
Several times over time I changed sizes of thumbnails WP generate when images are uploaded, always setting bigger size. Recently I set Thumbnail Width 600px width and Medium size Max Width 1800px. After several hundred images uploaded I realized that I need to set smaller image sizes, I reduced Medium size from 1800px to 1500px for future uploads. I know that already uploaded images will stay on disk in bigger resolution, and that is fine by me, I do not …
In Media Settings I have Thumbnail sizes set to width and height of 150 and "Crop thumbnail to exact dimensions (normally thumbnails are proportional)" is not checked. Since the checkbox is not checked, shouldn't the entire image be retained (since thumbnails are supposedly proportional)? However, it is not (see below). Why is this?
For some reason WordPress is ignoring my thumbnail sizes and keeping thumbnails cropped proportionately instead of specific dimensions. Here is what I have in functions.php: add_image_size( 'main-thumbnail', 728, 410, true ); and in content.php: <div class="thumbnail"> <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail( 'main-thumbnail' ); ?> </a> </div> I added these two things and regenerated my images with the Regenerate Thumbnails plugin, but it doesn't seem to matter. The images don't change. For some reason WordPress isn't recognizing the hard crop …
I have an issue for uploading .ppsx format on the media library. all the powerpoint format (pptx ppt, pps) can be uploading without problem except the .ppsx format and i don't know why. when i try to upload this format i have this message : Sorry, this file type is not permitted for security reasons. Even though WordPress by default(wp_get_mime_types()) allow .ppsx, I try the following methods, but method 1 and 2 does not work and method 3 is not …
I just migrated to Gutenberg block editor and I simply love it. After migration, I saw a dimension suggestion for images when trying to select the featured image. The problem is that we already have some editorial rules about the featured image and the editors are following this suggestion instead of our suggestions. I only want to change this value, but I couldn't find a hook to change these values to 1400 by 1400.
When uploading with video files to the Media Library, it's apparent that you need to increase the Max upload file size value. But this will be applied to all media types, including images and documents. Is there any way or simple code that can set different size limits based on the file type/extension so that I can grant a large limit for videos, a small limit for images, and a different limit for documents? I think WordPress should handle this …
Im trying to build a Digital Album website for my family old pictures and albums. I crated a custom post type via Pods called "Family Members" and crated something like 30 Posts / Pages with the family members full names. Now.. Im trying to upload a new image to my media library and can attach only one Page / Post (In my case it's a family member)to each media file (Image) I want to attach more than 1 post (More …
I'm working on a WordPress single site, where in front end, below a custom made form, where I have a file upload feature, I need to display the maximum upload size. In my local Laragon WAMP setup, the PHP post_max_size is set to 2G. I wanted to downgrade to only 20M (20 mb). After searching and reading several blog articles, I put the following code in my theme's functions.php: <?php // Set upload size limit to 20mb. @ini_set('upload_max_size', '20M'); @ini_set('post_max_size', …
I have two sites running WordPress 4.9.8 On one site I can see "Store uploads in this folder" option on in Media Settings On another site I cannot see "Store uploads in this folder" option in Media Settings I am admin on both sites. Why it happens? How to make it visible on both sites? Thank you
I use an image for a page that is uploaded back in 2014 up until now and back then I uploaded few images as well. But when I looked into the library, I could only find the images that are uploaded this year (both in use as well as not used). And yet, in the page editor the thumbnail of that image is still being displayed although I can't select it when I open the media selector. All images that …
I have a lot of uploaded image files and image sizes. So it would be better to organize media files into folders based on post type. I have just read this tutorial, but as I can see it works with plugins. How to change this to use in a theme? Thanks. function custom_upload_directory( $args ) { $id = $_REQUEST['post_id']; $parent = get_post( $id )->post_parent; // Check the post-type of the current post if( "post-type" == get_post_type( $id ) || "post-type" …