TransWikia.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!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP