How do you use WP slugs for PDF files / media?

In my opinion it is best to add an endpoint of the form mysite.com/pdf/<id> or something similar to your like. That way you avoiding attaching the attachments to posts/pages or create a page for each pdf file with is redundant imo for your needs. This is a very small and basic guide. You can modify … Read more

Changing path for media upload folder in wordpress multisite

This has been answered Hook filter to change wp_upload_dir() path in multisite , including code to hook into the upload_dir hook. Note that there is a setting in wp-config.php for the ‘base’ upload folder define(‘UPLOADS’, ‘wp-content/myimages’); So with this code, the uploads folder is wp-content/myimages. But, that changes the place WP looks for the media, … Read more

Can I hide certain upload folders in media library [duplicate]

Perhaps a bit quick and dirty, but this should work: function media_library_hide_dlm_downloads($where) { if(isset($_POST[‘action’]) && ( $_POST[‘action’] == ‘query-attachments’)) { $where .= ‘ AND guid NOT LIKE “%wp-content/uploads/dlm_downloads%”‘; } return $where; } add_filter(‘posts_where’, ‘media_library_hide_dlm_downloads’); Read more about the posts_where filter.

Post edit – Media Library – Only get images from current post

This will lock uploads to “Uploaded to this post” and will not show “All media items” or other options in WordPress media panels. Add this code to your function.php file add_action( ‘admin_footer-post-new.php’, ‘firmasite_mediapanel_lock_uploaded’ ); add_action( ‘admin_footer-post.php’, ‘firmasite_mediapanel_lock_uploaded’ ); function firmasite_mediapanel_lock_uploaded() { ?> <script type=”text/javascript”> jQuery(document).on(“DOMNodeInserted”, function(){ // Lock uploads to “Uploaded to this post” jQuery(‘select.attachment-filters … Read more