Support » Plugin: Media Library Assistant » [Plugin: Media Library Assistant] Bad Parent / Orphan possibly wrong?

  • Hello,

    first of all, thanks a lot for the plugin – that’s pretty close to what I was looking for for quite a while. 🙂 I’ve yet to adopt the system and play with it a little bit to fully embrace it on my site, but it appears to be the most intuitive approach to what I want to do anyway. 🙂

    Now, on to the problem. When browsing the MLA table view, I noticed that there’s a fair number of items marked with the “Orphan/Bad Parent” note. However, browsing the normal Media Library view, the items are all correctly attached to a post or page (and are in fact used on that page). Is this a known bug/limitation?


Viewing 15 replies - 1 through 15 (of 22 total)
  • Plugin Author David Lingren



    Thanks for using the plugin and for your kind words. If there are other features you’d like to see, let me know.

    Now, on to the problem. Your message is the first report I’ve had about problems with the where-used reporting.

    The “Bad Parent” notation means that the item is attached (i.e., the post_parent database field is not zero), but either the parent ID is for a post or page which has been deleted or the parent ID exists but the attachment is not used as the Featured Image and is not inserted in the body of the post/page. There are some problems with this field; for example, if you change the “Featured Image” for a post the post_parent doesn’t always get updated. It’s quite possible that there’s some way to use an item that I am not yet searching for.

    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.

    I’ll need more information to reproduce the problem and fix it. Can you tell me what’s in the “Featured in” and “Inserted in” columns of the MLA listing for the problem items? What’s in the ID/Parent column?

    For one of the problem items, how is it used in the post/page that should be its parent?

    The best way to help me look into this would be to send me some screen shots of the problem(s), e.g., the MLA listing page and the HTML view of the post/page content where the item is used. If you’re willing to do that or you have other information you don’t want to post here, go to the Our Story/Contact Us ( page at and give me your e-mail address. I’ll send you my e-mail address and we can exchange more information.

    Thanks again for using the Media Library Assistant and for your pateince while I work on this issue.


    Hello David,

    thank you for the swift response!

    The “Bad Parent” notation means that the item is attached (i.e., the post_parent database field is not zero), but either the parent ID is for a post or page which has been deleted or the parent ID exists but the attachment is not used as the Featured Image and is not inserted in the body of the post/page.

    Hmmmm… before I go into the details and look up the required information: if I understand this correctly, this does not cover the usage via a [gallery] shortcode, or does it?

    I do not insert the image into the post directly, and none of them is used as a featured image either. The images are attached to the post, and all I do is to use the gallery shortcode (WP standard gallery) to show the images.

    One or more of these images may be inserted into a different post and/or featured in a different post (because I’m using a “portfolio” custom post type, which I’d be hoping to replace with vanilla WP attachment pages and your plugin).

    Plugin Author David Lingren


    Aha! You’ve identified the problem – I don’t check for the [gallery] shortcode. You’d think after all the work I put into adding the [mla_gallery] shortcode to version .50 this would have been obvious to me.

    It would be helpful to me if you can send some examples of how you use [gallery], i.e., do you use any of the parameters it supports to modify the images you include?

    In any case I will start thinking of how to address this issue. The easiest thing to do would be to assume that any post/page with a [gallery] (or [mla_gallery]) is a valid parent for all attachments that use it as a post_parent. That wouldn’t always be accurate, and with the additional parameters supported by [mla_gallery] it would often be wrong.

    Another approach would be to actually run the shortcode and see which posts/pages it returns. That would be more accurate but might require a lot of database access. Perhaps I’ll make that an optional feature controlled by the Settings page.

    I welcome any further ideas on this topic. Thanks again for following up on this and for your feedback.

    Personally, I don’t think that 100% accuracy is necessary in that case – after all, one could use the “exclude/include” parameters in the gallery shortcode, and only show certain images – while still all of them are nicely and properly attached to an existing post. 🙂

    It seems like the only reliable option to actually determine which images are really used in the post/page itself (and not just attached) is to run the shortcode. Not really necessary from my point of view, but then again, my view is somewhat limited, as I’m only looking at it from my use case. 🙂


    Plugin Author David Lingren



    Thanks for sending more information by e-mail and for your comments on HTML rendering in [mla_gallery]. You wrote:

    I’ve been playing with the [mla_gallery] shortcode a little bit and I noticed a difference to the standard WP [gallery] shortcode: HTML in the image descriptions is not interpreted in mla_gallery.

    It’s true – I decided to filter the output to prevent malicious script in the content from being executed. However, WordPress takes a different approach:

    Why are some users allowed to post unfiltered HTML?

    I will change [mla_gallery] in my next release to conform to the choices WordPress has made. Thanks for your feedback on this issue.

    If your evaluation of that functionality differs from the default WP behaviour, my personal take would be: leave the choice up to the users, and add a setting to configure the behaviour.

    ( ) interpret markup (default WP behaviour)
    ( ) do not interpret markup (recommended, more secure)

    Something like that.


    Plugin Author David Lingren


    Thanks for the suggestion. I am going to add more control over the styles and HTML markup returned by [mla_gallery], and adding a “do/don’t interpret” parameter to the shortcode might be better than an option on the Settings page. I’ll default to the current WordPress behavior, of course.

    Plugin Author David Lingren


    I have released version 0.71, which adds “Gallery in” and “MLA Gallery in” columns to the MLA display. This release also distinguishes between a parent that does not exist and a parent that does not include any references to the attachment.

    I believe this resolves your issues with “BAD PARENT” and “ORPHAN” indications. Let me know if you have any further issues; thanks!

    ‘Gallery in’ and ‘MLA Gallery in’ seem to not be working for me. Addtionally i am receiving the (ORPHAN)(BAD PARENT) messages as well … running 1.00. i thought it may be that i didn’t have the Where Used set for these, but they are currently set to be Dynamic. Thoughts?

    Plugin Author David Lingren


    The Gallery in and MLA Gallery in logic looks for [gallery] and [mla_gallery] shortcodes in your post/page content. If a shortcode is found, the database query it contains is executed to see which attachments are actually displayed in the gallery.

    The BAD PARENT message means that the attachment is not actually used in the post/page to which it is attached. The ORPHAN message means there is no post/page that actually uses the attachment.

    If you have a post or page with a [gallery] or [mla_gallery] shortcode, and one or more of the ORPHAN/BAD PARENT attachments appears in the gallery – that’s an issue. If you can send me a link to the post/page in question and give me the HTML/Text source in the post/page content I will look into it.

    Let me know if that helps, and if you have any more information or questions about this issue. Thanks!

    i’ll try and pull this together for you. Just visited the Assistant again, and now the Title/Name column includes question marks on these items (ORPHAN?)(BAD PARENT?). Not sure if that helps you diagnose what might be happening. Don’t think the question marks were there before.

    Plugin Author David Lingren


    There are four where-used categories; Featured in, Inserted in, Gallery in and MLA Gallery in. The question marks are added when you disable one or more (but not all) of the categories, because some of the where-used checks are not performed so the results are not complete.

    For example, if you disable the “Gallery in” category the plugin will not process the [gallery] shortcodes and therefore cannot detect attachments that are part of the [gallery] output.

    If all four categories are disabled you will see “NO REFERENCE TESTS” in those columns.

    Ah, right. i had since set to ‘Cache’ for both of those. Just reset to ‘Dynamic’ and the questions marks are still there. Tried disabling to maybe flush the cache, then set ‘Dynamic’, still there. Hmm.

    Plugin Author David Lingren


    You can flush/refresh the Gallery in or MLA Gallery in cache by setting those options to “Refresh”. That performs a one-time refresh and then sets the option back to Cached.

    The question marks only appear when one or more of the four options are set to “Disabled”. Did you disable the Featured in or Inserted in categories? If none of the four options is Disabled and you still get question marks, that’s a separate issue.

    Check out this page. The images (in a [gallery]) are parented fine. The docs embedded in the [expand][mla_gallery] are orphaned/bad parent. Could it be that they are in the [expand]? These pages use jQuery Collapse-O-Matic plugin. Thanks!

    Text/HTML from Post

    [gallery columns="3" link="file" ids="4527,4525,4526,4524,4523,4528"]
    The above files are only a few of those available for download. Images are available in the following zipped folders. When possible, use these in World Mission Prayer League presentations as they match the look of our other publications. Enjoy!
    [expand title="Slide Images" tag="div" trigclass="level-2 third" targclass="level-2-targ"][mla_gallery post_mime_type="all" ids="4529,4530" mla_markup="file_list" mla_style="file_list_style" captiontag="span"][/expand][expand title="Slide Templates" tag="div" trigclass="level-2 third" targclass="level-2-targ"][mla_gallery post_mime_type="all" ids="4534,4535,4532,4533" mla_markup="file_list" mla_style="file_list_style" captiontag="span"][/expand][expand title="Powerpoint Templates" tag="div" trigclass="level-2 third" targclass="level-2-targ"][mla_gallery post_mime_type="all" ids="4537,4539,4536,4538" mla_markup="file_list" mla_style="file_list_style" captiontag="span"][/expand]

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘[Plugin: Media Library Assistant] Bad Parent / Orphan possibly wrong?’ is closed to new replies.