Support

Account

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

  • Hi @ryandorn

    You would probably need to modify the query yourself.
    Here’s an example that limits the query when visiting the uploader in admin. You need to do something like this but for when it’s triggered on your frontend form.

    
    //Manage Your Media Only
    function mymo_parse_query_useronly( $wp_query ) {
        if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/upload.php' ) !== false ) {
            if ( !current_user_can( 'update_core' ) ) {
                global $current_user;
                $wp_query->set( 'author', $current_user->id );
            }
        }
    }
    
    add_filter('parse_query', 'mymo_parse_query_useronly' );