Title: Search by parent
Last modified: August 20, 2016

---

# Search by parent

 *  Resolved [jorgeorpinel](https://wordpress.org/support/users/jorgeorpinel/)
 * (@jorgeorpinel)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/search-by-parent/)
 * In the Media Library Assistant list, it would be greatly useful to have another
   checkbox for “parent” meaning the parent post’s title or perhaps slug. Or is 
   there another way to list in the assistant all the media items in a post?
 * [http://wordpress.org/extend/plugins/media-library-assistant/](http://wordpress.org/extend/plugins/media-library-assistant/)

Viewing 15 replies - 1 through 15 (of 20 total)

1 [2](https://wordpress.org/support/topic/search-by-parent/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/search-by-parent/page/2/?output_format=md)

 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/search-by-parent/#post-3597728)
 * Thanks for your interest in the plugin and your question.
 * There are two columns you can add to the Media/Assistant submenu table listing
   that might help; “Parent ID” and “Attached to”. Parent ID is what you’d expect;
   the numeric post ID of the attachment’s parent post or page. The “Attached to”
   column displays the parent’s title – I think that’s what you’re looking for. 
   You can sort on either of these columns to group all the attachements with a 
   common parent.
 * The big difference in the two columns is what happens when you click the column’s
   value for a particular parent. The “Parent ID” column contains a link that will
   filter the Media/Assistant submenu on the ID, i.e., it will display all the attachments
   with that parent. The “Attached to” column will display the post/page edit page
   for the parent (that’s what the WordPress Media/Library submenu does).
 * I hope one or both of those columns contain the information you’re looking for.
   If not, let me know what’s missing and I will see if there’s something else I
   can do.
 *  Thread Starter [jorgeorpinel](https://wordpress.org/support/users/jorgeorpinel/)
 * (@jorgeorpinel)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/search-by-parent/#post-3597730)
 * David, you’re welcome and many thanks on your answer! What you described does
   solve my need 🙂
    I would still suggest to add the search-by-parent (name/slug)
   feature to avoid having to manually search a list ordered by “Parent ID” or “
   Attached to”. Great work on the plugin!
 *  Thread Starter [jorgeorpinel](https://wordpress.org/support/users/jorgeorpinel/)
 * (@jorgeorpinel)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/search-by-parent/#post-3597732)
 * Well, actually from what David said earlier it can be said that you CAN “search”
   by parent (or rather all media in a post) if you know the post’s ID (which is
   easy), just use the following URL:
 * …/wp-admin/upload.php?page=mla-menu&parent=1828
 * Changing 1828 for the post’s ID.
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/search-by-parent/#post-3597735)
 * Yes, your URL suggestion works, but it’s inconvenient. I have just added an easier
   method to my next release. Simply enter the ID in the “Search Media” box in the
   upper-right corner of the Media/Assistant submenu screen. A numeric entry in 
   the Search Box will match either the attachment ID or the Parent ID (post_parent).
 * Thanks for the suggestion!
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/search-by-parent/#post-3597741)
 * I have released version 1.20, which includes:
 * * New: If the search box contains (only) a numeric value it is interpreted as
   a search by attachment ID or parent ID (post_parent). You can search for a numeric
   value in the text fields, e.g., title, by putting quotes around the value.
 * Thanks again for the idea.
 *  Thread Starter [jorgeorpinel](https://wordpress.org/support/users/jorgeorpinel/)
 * (@jorgeorpinel)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/search-by-parent/#post-3597742)
 * Wow that sounds great! I’m updating asap.
 * p.s. I think you mean _textual _the second time you say _numeric _🙂
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/search-by-parent/#post-3597743)
 * Well, I guess I could say “search for the textual representation of a numeric
   value”…
 * If you enter a number without the quotes, it won’t search the text fields at 
   all – it goes straight to the ID and post_parent fields.
 * Anyway, you get the idea. Enjoy the new release!
 *  Thread Starter [jorgeorpinel](https://wordpress.org/support/users/jorgeorpinel/)
 * (@jorgeorpinel)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/search-by-parent/#post-3597744)
 * Oh I see! I was actually interpreting you differently before. I thought a search
   string with quotes would look in post titles instead of media titles. Haha anyway,
   cool! Thanks for the reply.
 *  Thread Starter [jorgeorpinel](https://wordpress.org/support/users/jorgeorpinel/)
 * (@jorgeorpinel)
 * [13 years ago](https://wordpress.org/support/topic/search-by-parent/#post-3597757)
 * Hello again David.
 * This is not working for me anymore (still in version 1.20). I’m searching for
   2086 or “2086′ or “2086” (id of post called “008-1930”) and can’t find anything
   🙁 Am I doing something wrong?
 * Here’s a couple screenshots that show (1) my search vs. (2) filtering by clicking
   on the parent:2086 link (after finding a media item in the unfiltered list)
 * 1. [https://docs.google.com/file/d/0B7JEImS_HANHdHR3cldFYUVBVEE/edit?usp=sharing](https://docs.google.com/file/d/0B7JEImS_HANHdHR3cldFYUVBVEE/edit?usp=sharing)
   
   2. [https://docs.google.com/file/d/0B7JEImS_HANHTUhCSFlGNlpnQmc/edit?usp=sharing](https://docs.google.com/file/d/0B7JEImS_HANHTUhCSFlGNlpnQmc/edit?usp=sharing)
 * Thanks and best regards.
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [13 years ago](https://wordpress.org/support/topic/search-by-parent/#post-3597758)
 * If you enter a numeric value in the Search box, e.g., 2086 without any single
   or double quotes or other characters, MLA will search for a match by post ID 
   or post_parent. If you put single or double quotes around the value, or if you
   enter anything other than digits in the search box, MLA will search for those
   characters in the text fields such as Description.
 * The screen shot `search results for "'2086'"` has single quotes around the value,
   so it’s a text search, not an ID search.
 * I just re-tested this in v1.30 and it’s working on my system; it should also 
   work in v1.20. Give it another try entering just the numeric digits. If it’s 
   still not working, try searching for an image, e.g., 9042, 9043. Let me know 
   one or both of those are not working for you.
 *  Thread Starter [jorgeorpinel](https://wordpress.org/support/users/jorgeorpinel/)
 * (@jorgeorpinel)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/search-by-parent/#post-3597760)
 * Sorry for the delayed response.
 * I updated to 1.30 in case that was a problem (I was having other difficulties
   which were fixed that way) but unfortunately I can’t figure out the search by
   ID or parent.
 * Here’s MLA listing the 1st item as 263: [https://docs.google.com/file/d/0B7JEImS_HANHUktpQ293enNmT0U/edit?usp=sharing](https://docs.google.com/file/d/0B7JEImS_HANHUktpQ293enNmT0U/edit?usp=sharing)
   
   and here’s a search (from that last screen) of the ID without quotes and trying
   every field joined by ‘or’ (also tried the default setting of title & description
   having same result: [https://docs.google.com/a/orpinel.com/file/d/0B7JEImS_HANHcEY4M1FjWmJnYlU/edit?usp=sharing](https://docs.google.com/a/orpinel.com/file/d/0B7JEImS_HANHcEY4M1FjWmJnYlU/edit?usp=sharing)
 * Not a big deal.
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/search-by-parent/#post-3597763)
 * Maybe not a big deal, but an issue none the less. I’m puzzled, because it’s s
   simple feature and (of course) it works on my test systems. I assume that the
   problem is limited to the search box – do the links in the Parent/ID column perform
   the search properly?
 * I’ll go back thru the code and see if anything else occurs to me. Maybe I can
   add some debugging information we can use to gather more data. I will keep you
   posted on my investigation.
 *  Thread Starter [jorgeorpinel](https://wordpress.org/support/users/jorgeorpinel/)
 * (@jorgeorpinel)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/search-by-parent/#post-3597764)
 * Yes. links in the Parent/ID column perform the search properly going to …wp-admin/
   upload.php?page=mla-menu&parent=1828&heading_suffix=Parent%3A+002-2010 (which
   I can just modify and reuse for parend id searches directly with the URL for 
   now, basically with the &parent=xxxx argument)
 * The search box doesn’t work, going to …wp-admin/upload.php?s=1828&mla-search-
   submit=Search+Media&mla_search_connector=AND&mla_search_fields%5B%5D=title&mla_search_fields%
   5B%5D=content&page=mla-menu&m=0&_wpnonce=73c89cc6d3&_wp_http_referer=%2Fcms%2Fwp-
   admin%2Fupload.php%3Fs%26mla_search_connector%3DAND%26mla_search_fields%255B0%
   255D%3Dtitle%26mla_search_fields%255B1%255D%3Dcontent%26page%3Dmla-menu%26m%3D0%
   26mla_filter_term%3D3747%26mla_filter%3DFilter%26paged%3D1&action=-1&m=0&mla_filter_term
   =3747&paged=1&action2=-1
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/search-by-parent/#post-3597765)
 * Well, that’s interesting, and helpful. Thanks for thinking of sending the URL
   value!
 * Towards the end of the “search box” URL string you can see `mla_filter_term=3747`.
   That implies that you have selected an “Att. Category” value from the drop-down
   list next to the “Filter” button. If you did, the Att. Category value would be
   added to the search criteria and an attachment would have to have BOTH parent
   =1828 AND attachment_category=3747 to be displayed.
 * Does that make sense? Did you do any category filtering in addition to (or prior
   to) trying the parent search?
 * By the way, I have added some debugging code to version 1.40, which I released
   last night. If you add “>|<” in front of your search value, e.g., “>|<1828”, 
   you will get about 14 “Warning:” messages with information I would find most 
   helpful. If you add “<|>” in front of the search all those messages will go to
   the PHP error log and not clutter up the display. When you upgrade to v1.40, 
   give that a try and send me the results.
 * I can’t make the combination of category filtering and searching fail on my system,
   but I think we’re on to something and I will keep at it. Thanks for your ongoing
   help and your patience!
 *  Thread Starter [jorgeorpinel](https://wordpress.org/support/users/jorgeorpinel/)
 * (@jorgeorpinel)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/search-by-parent/#post-3597766)
 * Always a pleasure DAvid.
 * > Towards the end of the “search box” URL string you can see mla_filter_term=
   > 3747. That implies that you have selected an “Att. Category” value from the
   > drop-down list next to the “Filter” button
 * I may have filtered that time but even if I don’t I get no results. I entered
   1828 right off …wp-admin/upload.php?page=mla-menuand the resulting URL was …wp-
   admin/upload.php?s=1828&mla-search-submit=Search+Media&mla_search_connector=AND&
   mla_search_fields%5B%5D=title&mla_search_fields%5B%5D=content&page=mla-menu&_wpnonce
   =36e6224824&_wp_http_referer=%2Fcms%2Fwp-admin%2Fupload.php%3Fpage%3Dmla-menu&
   action=-1&m=0&mla_filter_term=0&paged=1&action2=-1 (no results) so I don’t think
   the filtering is related to the problem I’m experiencing.
 * I installed 1.40 and tried >|<1828 in the search box. I get a lot of warnings!
   Here they are 🙂
 *     ```
       Warning: mla_query_posts_search_filter search = '1828' in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 724
   
       Warning: mla_query_posts_search_filter $search_clause = ' AND ( ( cms_posts.ID = 1828 ) OR ( cms_posts.post_parent = 1828 ) ) ' in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 740
   
       Warning: _execute_list_table_query $request = array ( 'm' => 0, 'orderby' => 'post_parent', 'order' => 'ASC', 'post_type' => 'attachment', 'post_status' => 'inherit', ) in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 675
   
       Warning: _execute_list_table_query self::$query_parameters = array ( 'use_postmeta_view' => false, 'orderby' => 'post_parent', 'order' => 'ASC', 'detached' => false, 'debug' => 'console', 's' => '1828', 'mla_search_connector' => 'AND', 'mla_search_fields' => array ( 0 => 'title', 1 => 'content', ), 'sentence' => false, 'exact' => false, 'postmeta_key' => '_wp_attachment_image_alt', ) in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 676
   
       Warning: _execute_list_table_query $results->request = 'SELECT SQL_CALC_FOUND_ROWS cms_posts.* FROM cms_posts WHERE 1=1 AND ( ( (cms_posts.post_title LIKE "%>|<1828%") OR (cms_posts.post_content LIKE "%>|<1828%")) OR ( cms_posts.post_parent IN ( select ID from cms_posts as b where b.<code>post_type</code> <> "attachment" and b.<code>post_title</code> like "%>|<1828%" ) ) ) AND cms_posts.post_type = "attachment" AND (cms_posts.post_status = "inherit" OR cms_posts.post_status = "private") ORDER BY cms_posts.post_date DESC LIMIT -200, 200' in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 677
   
       Warning: _execute_list_table_query $results->post_count = 0 in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 678
   
       Warning: _execute_list_table_query $results->found_posts = 0 in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 679
   
       Warning: mla_query_posts_search_filter search = '1828' in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 724
   
       Warning: mla_query_posts_search_filter $search_clause = ' AND ( ( cms_posts.ID = 1828 ) OR ( cms_posts.post_parent = 1828 ) ) ' in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 740
   
       Warning: _execute_list_table_query $request = array ( 'm' => 0, 'orderby' => 'post_parent', 'order' => 'ASC', 'post_type' => 'attachment', 'post_status' => 'inherit', 'offset' => 0, 'posts_per_page' => '200', ) in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 675
   
       Warning: _execute_list_table_query self::$query_parameters = array ( 'use_postmeta_view' => false, 'orderby' => 'post_parent', 'order' => 'ASC', 'detached' => false, 'debug' => 'console', 's' => '1828', 'mla_search_connector' => 'AND', 'mla_search_fields' => array ( 0 => 'title', 1 => 'content', ), 'sentence' => false, 'exact' => false, 'postmeta_key' => '_wp_attachment_image_alt', ) in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 676
   
       Warning: _execute_list_table_query $results->request = 'SELECT SQL_CALC_FOUND_ROWS cms_posts.* FROM cms_posts WHERE 1=1 AND ( ( (cms_posts.post_title LIKE "%>|<1828%") OR (cms_posts.post_content LIKE "%>|<1828%")) OR ( cms_posts.post_parent IN ( select ID from cms_posts as b where b.<code>post_type</code> <> "attachment" and b.<code>post_title</code> like "%>|<1828%" ) ) ) AND cms_posts.post_type = "attachment" AND (cms_posts.post_status = "inherit" OR cms_posts.post_status = "private") ORDER BY cms_posts.post_date DESC LIMIT -200, 200' in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 677
   
       Warning: _execute_list_table_query $results->post_count = 0 in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 678
   
       Warning: _execute_list_table_query $results->found_posts = 0 in ..wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 679
       ```
   

Viewing 15 replies - 1 through 15 (of 20 total)

1 [2](https://wordpress.org/support/topic/search-by-parent/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/search-by-parent/page/2/?output_format=md)

The topic ‘Search by parent’ is closed to new replies.

 * ![](https://ps.w.org/media-library-assistant/assets/icon-256x256.png?rev=973502)
 * [Media Library Assistant](https://wordpress.org/plugins/media-library-assistant/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/media-library-assistant/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/media-library-assistant/)
 * [Active Topics](https://wordpress.org/support/plugin/media-library-assistant/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/media-library-assistant/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/media-library-assistant/reviews/)

## Tags

 * [parent](https://wordpress.org/support/topic-tag/parent/)

 * 20 replies
 * 2 participants
 * Last reply from: [jorgeorpinel](https://wordpress.org/support/users/jorgeorpinel/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/search-by-parent/page/2/#post-3597771)
 * Status: resolved