add action only if gallery shortcode attribute is equal to?

enter image description here

I’m customizing the gallery shortcode. Now, when the user clicks on edit button as shown below:

We can see the gallery modal like below:

In the right sidebar, we can see the gallery settings. And I want to remove that settings. So, I am able to remove that. But the problem is that the settings would be removed everywhere.

What I want is if the shortcode attribute has some value then only remove the settings. For eg.:



Here, we have two gallery shortcodes written using code editor. After switching to the visual editor we can see the image like first in this post. When edit button is clicked for first gallery, it should remove the settings (because it has myattr="true") but when edit button is clicked for second gallery, it should not remove the settings (because it has no myattr).

Is this possible?

if(some_condition) {
  // remove the settings
}

Where, some_condition probably be using apply_filters('post_gallery',.., etc. If there’s anyway, I would be thankful to you.

Read more here:: add action only if gallery shortcode attribute is equal to?

Leave a Reply

Your email address will not be published. Required fields are marked *