How to revert the media structure from /uploads/year/month to the /uploads directory in wordpress?
How to revert the media structure from /uploads/year/month to the /uploads directory in wordpress?
How to revert the media structure from /uploads/year/month to the /uploads directory in wordpress?
Removing custom physical folders with rmdir
solved it actually the directories need 0755
Now, do not ask me why, but the UPLOADS constant the upload_path option seem to work different. While declaring define( ‘UPLOADS’, ‘../uploads’ ); generates this: https://staging.mywebsite.com/core/../uploads/2024/02/image.png Removing that declaration and filling the upload_path option instead with the same value ../uploads gives a different result: https://staging.mywebsite.com/uploads/2024/02/image.png with the images being uploaded in the path I wanted … Read more
Getting your form to upload an image as soon as it is selected rather that submitted is pretty straightforward, as you can submit the form whenever a field changes like this: <form action=”http://example.com” method=”post” action=”#”> <input type=”file” onchange=”form.submit()” /> </form> The difficulty is in keeping track of this at the server end. The user may … Read more
Upon debugging we found the wp_max_upload_size function was returning 1MB. The u_bytes and p_bytes were as expected and equal to 100MB as defined in our uploads.ini file but the application of upload_size_limit filter changed the size to 1MB i.e., the problem was at: return apply_filters( ‘upload_size_limit’, min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes ); A upload_size_limit_filter … Read more
As you can see in wp-includes/script-loader.php, the exact message ‘An error occurred in the upload. Please try again later.’ is the default error message. After looking further in wp-includes/js/plupload/handlers.js you can realize that something specific happened. You could debug this by setting a breakpoint to look up exact error code. See https://stackoverflow.com/a/13372025/2234089 for more information … Read more
I can’t see all images in my media library – How Can I reset the index of that library?
try this: function add_taxonomy_to_upload_dir( $upload ) { if ( isset( $_REQUEST[‘post’] ) ) { // wp-json/wp/v2/media $post = get_post( $_REQUEST[‘post’] ); } elseif ( isset( $_REQUEST[‘post_id’] ) ) { // wp-admin/async-upload.php $post = get_post( $_REQUEST[‘post_id’] ); } else { return $upload; } if ( ! $post || empty( $post->ID ) ) { return $upload; } … Read more
As far as I know, that feature is not officially supported, so there is no easy way to achieve it. But if you must, then it can be made possible by extending the wp.media.model.Selection.prototype.add function which is used to add new items to the selection list. Working example: (tried & tested with WordPress v6.2.2) ( … Read more