Ability to create default/unrecognized shortcode handler
-
I want to create a plugin that handles any unrecognized shortcodes. If there is a custom field by the same name as that shortcode, it would translate the shortcode into the value of that field. Otherwise, it would look for a custom post type called “templates” that has a post_name by the same name as the shortcode, and if found, it would output the contents of that post. The basic idea is reusable blocks of text or code that is embedded by name.
I’ve looked at the code, and it looks like a core change is needed. I’ll have to change the regex to add ‘[a-zA-Z\-\_\.]+’ to the list of alternations, and then if there isn’t a handler for the matched shortcode, call the ‘default’ handler.
Any suggestions about the “right” way of making that change, and of how to get the change pushed back into the main code base?
- The topic ‘Ability to create default/unrecognized shortcode handler’ is closed to new replies.