Restrict WordPress Media Library for a specific user role (users can only see/select own media)

add this to your functions.php or in a snippet, with this code the users with role external will only see their own uploads, any other role will see them all just has before. add_filter( ‘ajax_query_attachments_args’, ‘role_external’ ); function role_external( $query ) { $user_id = get_current_user_id(); if ( $user_id && current_user_can(‘external’) ) { $query[‘author’] = $user_id; … Read more

How can I create more upload paths, like a post corresponding to a post title folder used to store images of the same product

This probably isn’t the whole solution for you as you didn’t post any code, so I can’t incorporate what I know with anything, however, the following snippet will upload an image into a custom directory, made at the time of execution, as the attachment. I’ve commented the key lines… function upload_to_new_dir() { global $post; //This … Read more

Disabling direct access to images using .htaccess

I have added the following rewrite rule to my .htaccess (above the previous rewrite rule): RewriteRule ^wp-content/uploads/(.*)$ dl-file.php?file=$1 [QSA,L] You presumably have another .htaccess file in the /wp subdirectory that contains the main WordPress directives (ie. # BEGIN WordPress etc.). You should be adding the above rule to the /wp/.htaccess file, not the one in … Read more

I’m using add_meta_box() but want to include TinyMCE editor *and* Media Uploads for each box

Here is a complete tutorial with source files that do exactly what you want, You can upload multi images by cloning the input field and also you can preview, delete images with ajax, add multi metaboxes to multiple/different post types and more. http://www.deluxeblogtips.com/2010/05/howto-meta-box-wordpress.html And here you can find some good information on how you call … Read more