Why are orphan and unused showing in assistant
-
I searched the documentation and the support section and couldn’t find an answer to this. (The wordpress forum search is soooooo bad and hard to use! But I digress…)
When using the assistant I’m seeing a number of images with “Orphan” and “Unused” nomenclature, but also showing they are inserted in a post. I’m having a really tough time understanding how I’m supposed to interpret this and was wondering if someone could give me an explanation. Sample image attached…
https://www.ads-software.com/plugins/media-library-assistant/
-
Thank you for reporting this issue and for taking the time to document it with the link to your example. You have found a defect introduced in my most recent upgrade to v1.94. When the only “where-used” reference to an image is an insert in the body of a post/page, the reference was not recorded and the parent association was not tested.
I have reproduced and corrected the defect, and the fix will be part of my next version. I will leave this topic unresolved until the next version goes out.
In the interim you can download the “Development Version”, which contains the fix. Go to the “Developers” tab above and click on the “Development Version” link to download it. If you would like a copy by e-mail, you can send me your contact information from the Contact Us page at our web site:
I share your pain with regards to finding specific information in the Support Forums. For your information (if you haven’t found it already) here is an earlier support topic that has more information on what the various where-used status indicators mean:
I regret any inconvenience this caused you and the time required to research and document the bug. Please let me know if you try the interim version and if you have any other questions or problems regarding MLA. Thanks again for your help and for your interest in the plugin.
Awesome David. I just installed the dev version and things do indeed look much better. I’m going to play around with it some more to see if I notice anything else.
Two more questions for you:
1. When a search is performed does it search the image url? I’ve tried searching for a term in the file path/name (url) but my impression is that it doesn’t search the url field. Is there anyway to get it to search the url field (there are times when I know a file name from a previous import, but don’t know anything else about the image.)
2. If an image is showing as orphan/unused what is the best way to mark it as “OK” and used. I think that if I’m using the image in a custom taxonomy (such as the awesome Meta-slider plugin) you will not see it attached anywhere. I just thought of an idea… is there a way to specify custom taxonomy to search for attachment / usage? That way MLA would be somewhat dynamic in that the user could just pick from a list of custom taxonomies to search. But then, I’m not a WP expert so maybe not possible or smart to do that.
Thanks!
-NormOh, one more thing… a suggestion.
I had found your post on Usage orphan/bad parent and it did help.
I think it would be great if you could merge that information and the information in “Featured/Inserted” under the help tab into a “Definitions” tab. That way you could have a tab that provides definitions for columns that you often get questions on, and terms such as unattached, orphan, bad parent and these definitions would be available for quick reference right under the help tab.
Thanks,
-NormThanks for posting your testing results and for your thoughtful suggestions.
I have added a “Where-used Reporting” tab to the help dropdown on the Media/Assistant submenu. It contains an updated and expanded version of the explanations given in the earlier support topic.
I will have to think through your “search the image url” and “mark it as ‘OK’ and used” suggestions; neither of these features are available in the current MLA version. Some users have complained that there are too many Search options already, and the taxonomy/Meta Slider suggestion is an example of the many, many plugins that use Media Library items in some way. I can’t add and maintain MLA code for all of them.
The best way to handle both of your suggestions may be to add hooks in the search and where-used logic so you can add a bit of PHP code to do anything you need. I am actively working on adding hooks to the Media/Assistant submenu and I will investigate a solution for search and where-used reporting.
I will leave this topic unresolved until the next MLA version goes out, and I will update it if I have new code for your to try out. Thanks again for all your input and your interest in the plugin.
I have added some hooks to support your “search the image url” and “mark it as ‘OK’ and used” suggestions. I have also added them to the
mla-list-table-hooks-example.php.txt
example plugin in the/media-library-assistant/examples
directory. All of this has been uploaded to the Development Version for you to experiment with.The following code in the example plugin demonstrates your first idea:
public static function mla_list_table_search_filter_fields( $active_fields, $all_fields ) { if ( in_array( 'name', $active_fields ) ) { /* Uncomment next line to add File URL (guid) to the list of active search fields when the "Name" box below the Search Media text box is checked */ //$active_fields[] = 'guid'; } // Uncomment next line to ALWAYS add File URL (guid) to the list of active search fields //$active_fields[] = 'guid'; self::$search_fields = $active_fields; return $active_fields; } // mla_list_table_search_filter_fields public static function mla_list_table_search_filter_inner_clause( $inner_clause, $inner_connector, $wpdb_posts, $sql_term ) { if ( in_array( 'guid', self::$search_fields ) ) { $inner_clause .= "{$inner_connector}({$wpdb_posts}.guid LIKE {$sql_term})"; } return $inner_clause; } // mla_list_table_search_filter_fields
Your second idea is a bit more specific to your application, so I have left it to you as an exercise. If you need additional assistance with it, give me the details on what you want to do and I can be more helpful.
In addition to the hooks I’ve just added there are many new hooks for the Media/Assistant submenu table. You could use them, for example, to add one or more columns to the table with your own “where-used” information. All of the new hooks are in the example plugin and in the Settings/Media Library Assistant Documentation tab (towards the bottom).
Please let me know if you have a chance to try out these new features. I am interested in any feedback you have before I make my next release. Thanks for the ideas and for your help in testing them.
I have released MLA version 1.95, which contains the code required to implement your two ideas.
I am marking this topic resolved, but please update it if you have any problems or further questions about using the new hooks to get the results you need. Thanks again for the ideas and for your interest in the plugin.
Hi David;
I guess I could use some direction from you as to how to accomplish what I’m trying to do.
I have a site that has a lot of images in the Media Library. Many of the images are either not used anywhere, or are close duplicates so I want to consolidate and delete the close duplicates. I’ve been manually cleaning it up, but it is extremely time consuming.
Some of the images are in the Media Library but are not attached to any post; rather they are used in a slider plugin (could be either Metaslider or Revolution slider).
So what I want to do is get a list of all images that are
1. not attached to a post or page
2. not used in a [gallery]
3. not inserted in a post or page
4. not featured in a post or page
5. not used in a [metaslider]The “unattached” filter view on the top menu is somewhat what I want, but it only checks to see if a media item is unattached. However, that media item could be used in [gallery].
Is there a way where I could get an “unused” top menu item that checks all the known usage areas, and if they all come up “negative”, then show them in the view. That would give me the ability to search the entire media library for items not used and quickly delete / clean it up.
And secondarily, how would I go about checking for usage in [metaslider]. I know that it is somewhere in the example plugin code that you provide, but I just have a brain-block as to where to start.
Thanks as always!!
-NormThanks for an interesting question. The solution includes the following two steps:
- Define a Custom Field mapping rule using the
reference_issues
data source. - Define a “Table View” to select only the items with a value of “(ORPHAN) (UNATTACHED)” in the custom field.
To define the mapping rule:
- Make sure you have all the “where-used” categories turned on, at least while you’re doing this mapping step.
- Go to the Settings/Media Library Assistant Custom Fields tab and scroll down to the “Add a new Field and Mapping Rule” section.
- Enter something like “Reference Issues” in the field name text box.
- Select
reference_issues
as the Data Source. - Check the “MLA Column” box just to the right of the “Native” dropdown.
- Check the “Delete NULL values” box.
- Click “Add Field and Map All Attachments”.
To define the Table View:
- Go to the Settings/Media Library Assistant Views tab and scroll down to the “Add New View” section.
- Enter
unused
for the slug. - Enter “Unused” for the Singular and Plural labels.
- Enter
custom:Reference Issues=(ORPHAN) (UNATTACHED)
in the Specification text box. Note the single space between the two categories. - Uncheck the “Post MIME Type” box, leave the “Table View” box checked.
- Scroll down and click “Add View”.
If all of that goes as planned you will have a new Media/Assistant view that shows only the unused items.
Of course, this part of the solution does not detect items used in the
[metaslider]
shortcode. For that, a small custom plugin along the lines of themla-simple-mapping-hooks-example.php.txt
example will be required. It would perform the same kind of tests MLA uses for the “Gallery in” reference test and modify the custom field values appropriately. Basically, the approach is to go through all pages and posts in the site, find every instance of the shortcode, then execute the shortcode to see which items it returns. Yes, it’s expensive in terms of database access.I found the “Meta Slider, made by Matcha Labs” in the WordPress repository – is that the plugin you are using? If so, some research would be required to figure out how it stores the item selections in the database. The shortcode itself simply contains an
id=
parameter that names the slider, not the included items.If you’d like me to look into that, let me know. I am about to leave on a trip so it will be the second half of April before I can do that. Thanks for your patience and your understanding.
Norm,
Let me know if you still want help with this topic or a custom plugin for Meta Slider where-used information.
- Define a Custom Field mapping rule using the
- The topic ‘Why are orphan and unused showing in assistant’ is closed to new replies.