How to disable (and hide) the Media Library for certain users?

I did a googles of the issue (using ‘wordpress restrict media access’) and got this link on the first page https://www.wpbeginner.com/plugins/how-to-restrict-media-library-access-to-users-own-uploads-in-wordpress/ Which has this code // Limit media library access add_filter( ‘ajax_query_attachments_args’, ‘wpb_show_current_user_attachments’ ); function wpb_show_current_user_attachments( $query ) { $user_id = get_current_user_id(); if ( $user_id && !current_user_can(‘activate_plugins’) && !current_user_can(‘edit_others_posts ‘) ) { $query[‘author’] = $user_id; … Read more

Update media library attachments

edit: ok after working on this for the last hour ive finally found a solution that works without affecting uploading and without messing with ignore or reset wp.media.frame.on(‘open’, function() { if (wp.media.frame.content.get() !== null) { // this forces a refresh of the content wp.media.frame.content.get().collection._requery(true); // optional: reset selection wp.media.frame.content.get().options.selection.reset(); } }, this);

Media Library Latency, Lag, CRON?

When I add images to my Media Library they aren’t available in the Media Library for about an hour. It seems like there is a queue or some sort of CRON that fires. WordPress handles uploads immediately, there is no latency, queues, or cron unless you introduce one yourself. The image appears in the media … Read more

Extract url of every image in library?

First you have to get all attachments. You can use get_posts function for this: $attachments = get_posts( array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ) ); Then you have to loop through them and get their urls using wp_get_attachment_url: foreach ( $attachments as $att ) { echo wp_get_attachment_url( $att->ID ); }

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