Unable to upload files greater than 1MB in size in Multisite network?

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

WordPress Permissions Issue for Media Library / uploading

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

Modify upload directory to use post category slug in file path on multisite installation

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

wp.media multiple selection limit

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

How do I display a PDF thumbnail as a link to the PDF without uploading the image

The PDF images created by wordpress are stored within the PDF attachment object metadata. [ { “id”: 121, “media_type”: “file”, “mime_type”: “application/pdf”, … “media_details”: { “sizes”: { “full”: { … “source_url”: “<domain>/wp-content/uploads/document-name-pdf.jpg” } } ] Extracting the image from the PDF Adding an image block or adding a featured image to a post requires an … Read more

Add URL in image upload error message

It’s probable that HTML tags are being removed from output. You can test this by adding other HTML tags (ex: <strong>) and see if they are removed. If the bold text shows, it’s possible then that bold text is permitted but not links (using wp_kses() or similar). I backtracked the code quite a bit to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)