Media Library Assistant
[resolved] Filtering "Ophan" media do batch delete ? (5 posts)

  1. mll
    Posted 3 years ago #

    Hello David,

    On http://wordpress.org/support/topic/plugin-media-library-assistant-bad-parent-orphan-possibly-wrong?replies=9 , you said

    The "Orphan" notation means that my search did not find any post or page which uses the item as a Featured Image or has the item inserted in the body of the post/page.

    and if I get it right, now it means the image is used neither in a [gallery] nor a [mla_gallery].

    So I'd like to use this property to batch delete such orphan media, since they're actually used nowhere. But in the MLA main screen, I don't see any way to filter the list this way.

    Maybe a new feature ?

    Kind regards.


  2. David Lingren
    Plugin Author

    Posted 3 years ago #

    Yes, you have it right, The "Orphan" status means that the item is not used as a Featured Image, not inserted in the body of the post/page, and not actually displayed by any [gallery] or [mla_gallery] shortcode. It's possible that the item is displayed by another plugin such as "NextGEN Gallery", but that's a problem I haven't addressed yet.

    Sorting and filtering the list is done by adding appropriate SQL clauses to the database query that builds the list. The "where-used" processing cannot be done in this way. For example, to create the "Inserted in" entries every post/page in the database must be scanned to see if the file name(s) appear in the body of the post/page. For the "Gallery in" column, every [gallery] shortcode is found and executed to see which items are returned.

    To minimize the processing load, this work is only done for the items displayed in the current page of the listing. To do the processing for all items, then sort the results would be much too processing intensive.

    What I could do is provide a utility function that does the job only when asked for and then records the results as a category or tag or other taxonomy term, e.g., "orphan", "bad parent", "invalid parent". Then, you could filter the listing by those terms and do whatever you want with the results.

    Would that be enough?

  3. mll
    Posted 3 years ago #

    IIUC, that would allow to tidy unsused images, so that sure would be enough for me.

  4. David Lingren
    Plugin Author

    Posted 3 years ago #

    I have just released version 1.10, which allows you to map attachment metadata such as parent issues and reference issues, e.g., "orphan" status, to custom fields.

    You can make the resulting custom field a sortable column in the Media/Assistant submenu table. That should help you do the analysis and cleanup you desire. Let me know if you have any issues with this new feature.

    Thanks again for the suggestion and for your patience.

  5. mll
    Posted 3 years ago #

    thanks again !

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Media Library Assistant
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.