AnswerBun.com

Restricting Users to View Only Media Library Items They attached to post

WordPress Development Asked by newneo on December 14, 2020

this plugin saves me from having a lot of snippets to paste in my site, but despite this, I still have a big problem,
I need to tell wordpress to display only the images attached to the post only.

I did a test to illustrate the problem to you

enter image description here

so far I have found this code to do the trick
code

add_action( 'admin_footer-post-new.php', 'media_library_filter' );
add_action( 'admin_footer-post.php', 'media_library_filter' );
function media_library_filter() { 
    ?>
    <script type="text/javascript">
        jQuery(document).on("DOMNodeInserted", function(){
            jQuery('select.attachment-filters [value="uploaded"]').attr( 'selected', true ).parent().trigger('change');
        });
    </script>
    <?php 
}

but apparently it doesn’t work well now, after several updates of ACF plugin and wordpress 5.5 .
it still works but buggy .. what is certain. he is not reliable now!

if someone has knowledge of php and a solution with clear code and following wordpress standards to do the same task.

he can help me or direct me to where to go

otherwise I found other codes and articles but nothing seems to work this could help you to understand.these people have tried to look into it. they all seem very confused and the posts are very dated and no code works

post 1

post 2

I thought I was done with this problem but unfortunately today it becomes a priority

to explain the reason for this need,
I created a real estate site, each post is a property and each image is unique and related to its property. therefore the user does not need to see the other images of the other properties.
There is nothing interesting to add it will be total confusion..

He only needs to see the attached images and add new images

I Hope it was clear and it makes sense to you

Add your own answers!

Related Questions

&nbsp not working in comments

1  Asked on December 17, 2021 by wplearner

   

display post pdf attachments in side bar with link text

0  Asked on December 17, 2021 by tdouglassnewby

     

Conditional redirect to several pages

1  Asked on December 17, 2021 by peter-varga

 

the_post_thumbnail doesn’t resize properly

0  Asked on December 17, 2021 by user55555

 

Drop down question

0  Asked on December 17, 2021

       

Prevent private post 404

2  Asked on December 15, 2021 by ben-everard

   

Importing CSV into database table not working?

1  Asked on December 15, 2021 by coder-sathya

       

Display a CPT based on a metabox selection

1  Asked on December 15, 2021 by bigant841

     

advanced custom fields and contact form 7

1  Asked on December 15, 2021 by social

     

Show MySQL errors that occur when I excute $wpdb->insert()

1  Asked on December 15, 2021 by diego-valverde

     

Parent page for CPT

1  Asked on December 12, 2021 by don-munter

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP