Home Forums ACF PRO Restrict Media Library acf_form Reply To: Restrict Media Library acf_form

  • Hi Jonathan,

    Thanks for the response!

    That code didn’t work for me straightaway so I keep digging and happened to stumble across this, which is working for me straight out of the box.

    add_filter( 'posts_where', 'devplus_attachments_wpquery_where' );
    function devplus_attachments_wpquery_where( $where ){
    	global $current_user;
    	if( is_user_logged_in() ){
    		// we spreken over een ingelogde user
    		if( isset( $_POST['action'] ) ){
    			// library query
    			if( $_POST['action'] == 'query-attachments' ){
    				$where .= ' AND post_author='.$current_user->data->ID;
    	return $where;

    Thanks again!