Thanks for your question and for including the complete text of your shortcode; very helpful. You can use a taxonomy query to add the tag exclusion to your existing shortcode. You can read about them in the Taxonomy Queries, the “tax_query” section of the Settings/Media Library Assistant Documentation tab. Here is a shortcode that achieves your goal:
[mla_gallery]
mla_markup=information-leaflets
tax_query="array(
'relation' => 'AND',
array(
'taxonomy' => 'attachment_tag',
'field' => 'slug',
'terms' => 'information-leaflet+not-expired+neurology'
)
array(
'taxonomy' => 'attachment_tag',
'field' => 'slug',
'terms' => 'headache-clinic',
'operator' => 'NOT IN'
)
)"
[/mla_gallery]
This example uses an alternative syntax that can help you avoid parsing problems with long shortcodes; the “enclosing shortcode” syntax. You can find more information in the “Entering Long/Complex Shortcodes” section of the Documentation tab. If your page includes multiple [mla_gallery] shortcodes, be sure to add the closing [/mla_gallery] to every shortcode on the page to avoid parsing problems.
I hope that gets you started on a solution for you application. I am marking this topic resolved, but please post an update if you have problems or further questions regarding the above suggestions. Thanks for your interest in the plugin.
Hi David,
Thank you for your quick response. I’ve tried your solution but it is not returning any results.
So I thought maybe it is something to do with the slugs, so tried the following, but that is returning everything tagged by those three term ids, excluding the term correctly.
[mla_gallery]
mla_markup=information-leaflets
tax_query="array(
'relation' => 'AND',
array(
'taxonomy' => 'attachment_tag',
'field' => 'id',
'terms' => array(256, 255, 377)
)
array(
'taxonomy' => 'attachment_tag',
'field' => 'id',
'terms' => array(490),
'operator' => 'NOT IN'
)
)"
[/mla_gallery]
Any ideas most welcome.
Thanks for taking the time to try and adapt my suggestions and for your update. I think I have a better idea of your goal.
Based on your first post I thought “information-leaflet+not-expired+neurology ” was a single term slug. Now I think you intended it to be “ information-leaflet ” AND ” not-expired ” AND ” neurology “, i.e., items must be assigned to all three terms to be included. Is that right? If so, cleaning up the terms and adding a parameter should give you what you want. Here’s an update of my original suggestion:
[mla_gallery]
mla_markup=information-leaflets
tax_query="array(
'relation' => 'AND',
array(
'taxonomy' => 'attachment_tag',
'field' => 'slug',
'terms' => array('information-leaflet', 'not-expired', 'neurology'),
'operator' => 'AND'
)
array(
'taxonomy' => 'attachment_tag',
'field' => 'slug',
'terms' => 'headache-clinic',
'operator' => 'NOT IN'
)
)"
[/mla_gallery]
Of course, your ID-based alternative will also work if you add the ‘operator’ parameter to the query.
I hope that completes the solution; let me know if you have any problems or further questions.
Hi David,
Thank you so much for your help with this – it’s exactly what I was after.
I really appreciate your speedy support with this.
Many thanks,
Huseyin