How can I hide media library images from general users?

To let the current users only view his/her uploaded attachments, add the following code to your themes actions: add_filter( ‘posts_where’, ‘devplus_wpquery_where’ ); function devplus_wpquery_where( $where ){ global $current_user; if( is_user_logged_in() ){ // logged in user, but are we viewing the library? if( isset( $_POST[‘action’] ) && ( $_POST[‘action’] == ‘query-attachments’ ) ){ // here you … Read more

WP 3.5 media uploader API set selected item

I found the solution from here: https://stackoverflow.com/questions/13936080/pre-select-images-when-opening-wordpress-3-5-media-manager And it works. Here’s my modification and this is using a single-image select media frame: frame.on(‘open’, function(){ var selection = frame.state().get(‘selection’); var selected = $(‘#image-id’).val(); // the id of the image if (selected) { selection.add(wp.media.attachment(selected)); } });

Hook for image edit popup

The answer is there is no damn hook for the edit button. It’s just a bunch of JS contained within wp-includes/js/tinymce/plugins/wpeditimage/plugin.js. I’ve included the barebones of what you need below. Key points: a. Clicking an element with a data-wp-imgselect attribute will open the image edit dialogue. You need to change that to something else if … Read more

Multisite: use media from one site vs. copying the same media to all language sites?

I think separate language site is better in most case, until better auto-translation technology appear. MultiSite Language Switcher plugin is a good plugin for this purpose. Media can be linked by url, you can even use external/dedicated site for storage block. If necessary, and there’s no main storage limitations simply create rsync cron to copy … Read more

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