How to permanently disable a SPECIFIC shortcode?

Hey,

I’ve searched for this, but I only find how to disable shortcodes altogether, or old discussions regarding the era where shortcodes weren’t integrated in “Cornerstone”.

My problem is that I am using a WordPress plugin (“Table of Contents Plus”) that generates a table of contents using the [toc] shortcode. And, of course, this interferes with the already existing [toc] shortcode in Cornerstone.

I am able to sort this out by deleting or renaming the corresponding toc.php file in wp-content/plugins/cornerstone/includes/shortcodes … but when the theme gets updated, the original toc.php gets re-installed and my plugin breaks again.

Is there any permanent way to choose not to use a specific shortcode, or avoid having it re-enabled with every theme update? Again, I am NOT trying to disable all shortcodes, just this one…

Thanks if you can help.

Hi @Carlos,

Thanks for writing in.

It sounds like you might be having an issue with a third party plugin or script. Regretfully, we cannot provide support for third party plugins or scripts as our support policy in the sidebar states due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s plugin or script. Because of this, any questions you have regarding setup, integration, or troubleshooting any piece of functionality that is not native to X will need to be directed to the original developer.

Thank you for your understanding.

As far as I remember, everytime I’ve asked you something (not that many times) the answer has always been to hire a developer or ask somewhere else, like nothing is never related to your product, but of course, you never forget to say “thanks for my understanding” at the end. I’m sorry but my understanding is wearing thin at this point. Look, I don’t know, it’s possible that sometime I did get help. But as I say, all I remember is this kind of answer and this is getting old since day one.

I understand that maybe you can’t help me, because what I am asking can’t be done, and then, well, it’s what it is. But I am not asking for third party support. I am asking for YOUR support, the one I can never get. How to disable a shortcode. The “original developer” could use exactly the same reasoning you are using, to direct me towards you. Not to mention this other plugin is free, while I paid good money for your product. Not that this implies eternal and perfect support, of course but… well never mind.

So, if you can’t help, say so. Tell it like it is. That’s ok.

Thank you for your understanding.

Hi there,

There is no way to remove an existing shortcode remotely from the custom code given that there are two shortcodes of the same name. The function is remove_shortcode() https://developer.wordpress.org/reference/functions/remove_shortcode/ and it can remove a shortcode without fail. The question is which one, if you’re lucky then you may able to remove cornerstone’s [toc], if not, then the one you’re removing is your plugin’s [toc].

The issue here is your plugin’s [toc] was added first, then overwritten by cornerstone’s [toc], and using remove_shortcode() will remove cornerstone’s [toc] which overwritten the previous [toc] resulting to no registered shortcode at all.

The possible solution is modify your plugin’s code by customization and registered its shortcode later than any existing plugins (such as cornerstone). The later the registration, the higher the chance it will overwrite the existing one. OR, simply re-register your plugins shortcode under wp_head action, but I’m not sure how to do that as I’m not familiar with your plugin’s shortcode function name.

So yes, you may have to contact a developer or the plugin author.

Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.