Front end form with images and media_handle_upload logic?

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

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

Getting fatal error when using manage_media_columns filter of WordPress

It looks like the issue is coming because of the conflict of the hooks (manage_media_columns and manage_{$screen->id}_columns) because when we manage_{$screen->id}_columns used for media it becomes manage_media_columns and started conflicting. The same details are mentioned in the documentation link of the hook. Link: https://developer.wordpress.org/reference/hooks/manage_screen-id_columns/#more-information

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