1

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

enter image description here

We can see the gallery modal like below:

enter image description here

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.:

[gallery myattr="true" ids="1,2,3"]
[gallery ids="5,7,9"]

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.