Looking for a way to insert PDF image preview in TinyMCE
Looking for a way to insert PDF image preview in TinyMCE
Looking for a way to insert PDF image preview in TinyMCE
upload image to wordpress media library failed for custom post type
Block non logged in users from accessing the media library
I think what you need is media_upload_{$type} hook. Here’s the documentation for it: https://developer.wordpress.org/reference/hooks/media_upload_type/ There’s also an easier way to achieve a similar result, by using the filter wp_handle_upload which is really straightforward. Here’s the doc about it: https://developer.wordpress.org/reference/hooks/wp_handle_upload/ If you could provide more details about the result you want to achieve, I’ll try my … Read more
Here’s how I did it, using a form to id file and set doc type, uploading with media_handle_upload, then post-processing using the attachmentID and combo box choice from the form with wp_set_object_terms: function myFileUploader() { if (isset($_POST[‘submit’])) { require_once( ABSPATH . ‘wp-admin/includes/image.php’ ); require_once( ABSPATH . ‘wp-admin/includes/file.php’ ); require_once( ABSPATH . ‘wp-admin/includes/media.php’ ); $doctype = … Read more
The GUID is a unique identifier. That is its only purpose. When it’s a post, I think guid is self-evident. But what is the correct formulation/destination for that URL when it is an attachment? Attachments are posts. If the GUID is being used then the attachment is being consumed from a feed as a post. … Read more
Load images from CDN and custom features to “Add Media” dialogue
Uploading directly to the wp-content/uploads folder using FTP or likewise will not make it show up in the Media Library. The files have been uploaded successfully, but WordPress requires the media ID to be added to the database. Only once the media ID is added to the WP database do the files show up in … Read more
Media is the post type (post_type=”attachment”), so most operations are done with wp post command. By default, wp post manage blog posts (post_type=”post”), therefore by fetching post IDs you must add –post_type=attachment indicating the type of posts. And to update media meta you should use wp post meta update <id> <key> <value> Your entire command … Read more
How can I change the page title of PDFs opened from a WordPress link which use the browser’s viewer?