Title: shortcode attachment_category not working
Last modified: May 25, 2019

---

# shortcode attachment_category not working

 *  Resolved [osxxso](https://wordpress.org/support/users/osxxso/)
 * (@osxxso)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/shortcode-attachment_category-not-working/)
 * I have tried adding the following shortcode to a test page and it returns blank…
 * [mla_gallery attachment_category=’minutes’]
 * The following shortcode works fine and displays all the PDF documents in my media
   gallery…
 * [mla_gallery post_parent=all post_mime_type=application/pdf size=icon link=file]
 * I have multiple documents in the media gallery with Att. Categories “Minutes”
   and slug “minutes” so I’m not sure what’s going on?
 * Thanks…

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [osxxso](https://wordpress.org/support/users/osxxso/)
 * (@osxxso)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/shortcode-attachment_category-not-working/#post-11573811)
 * This worked…
 * [mla_gallery post_parent=all post_mime_type=application/pdf size=icon attachment_category
   =minutes link=file]
 * Thanks..
    -  This reply was modified 6 years, 12 months ago by [osxxso](https://wordpress.org/support/users/osxxso/).
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/shortcode-attachment_category-not-working/#post-11574203)
 * Thanks for your question and especially for taking the time to work it through
   and report success before I could get to it.
 * As you discovered, the `[mla_gallery]` shortcode has a default `post_mime_type
   =image` setting that prevented your PDF documents from being included in the 
   gallery display. Also by default, `[mla_gallery]` will only display items “attached”
   to the current post/page, which is why `post_parent=all` is required in your 
   second example.
 * If you code something like `attachment_category=minutes` to filter the gallery
   the default “attached to” setting is turned off, so you final shortcode could
   be a bit simpler:
 *     ```
       [mla_gallery post_mime_type=application/pdf size=icon attachment_category=minutes link=file]
       ```
   
 * I will leave this topic resolved, but please update it if you have any problems
   or further questions regarding the above explanation. Thanks for your interest
   in the plugin.
 *  [hmeader](https://wordpress.org/support/users/hmeader/)
 * (@hmeader)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/shortcode-attachment_category-not-working/#post-11704758)
 * Is this something I can use to add dynamically to a page any and all items of
   a type/category within a date range, or Order it Descending? So whenever I add
   something to the Media Library with that Category, it’ll show up in that page
   with code?
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/shortcode-attachment_category-not-working/#post-11705484)
 * [@hmeader](https://wordpress.org/support/users/hmeader/) –
 * Thanks for your question. Yes, you can use the `[mla_gallery]` shortcode to display
   a gallery of items assigned to a specific category (or Att. Category) and you
   can order and/or filter the display by date. For example, you can display the
   ten most recent items:
 *     ```
       [mla_gallery category=some-term orderby=date order=DESC posts_per_page=10]
       ```
   
 * or change `category=some-term` to `attachment_category=some-term` if you are 
   using MLA’s Att. Categories taxonomy. You can add `post_mime_type=all` to display
   non-image items like PDF documents.
 * You can compose a more elaborate date query to restrict items to a particular
   date range. More information can be found in the ‘Date and Time Parameters, the“
   date query” ‘ section of the Settings/Media Library Assistant Documentation tab.
 * If you have problems or further questions regarding the above suggestions, please
   open a new support topic so I can give you more specific guidance. Good luck 
   with your application!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘shortcode attachment_category not working’ 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/)

 * 4 replies
 * 3 participants
 * Last reply from: [David Lingren](https://wordpress.org/support/users/dglingren/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/shortcode-attachment_category-not-working/#post-11705484)
 * Status: resolved