You didn’t add the shortcode via the shortcode API. WordPress only recognizes shortcodes if they are added with:
add_shortcode( 'yourshortcode', 'yourshortcodefunc' );
I personally would not use preg_replace for this because it is more of a hit and miss. You should follow the official guidelines off the WordPress Codex. Recommended code structure for shortcodes is:
// [bartag foo="foo-value"]
function bartag_func( $atts ) {
extract( shortcode_atts( array(
'foo' => 'something',
'bar' => 'something else',
), $atts ) );
return "foo = {$foo}";
}
add_shortcode( 'bartag', 'bartag_func' );
Related Posts:
- All shortcodes not working on custom theme
- enqueue script only if it is not already enqueue
- How to parse nested shortcodes?
- Adding Custom Fields for Img in Posts
- How To Ignore a Filter On Applying Filter the Content In a Function
- Shortcode display outside the div
- Pass $this to function nested in another public function of the same class
- Dynamic HTML not displaying at respective place
- shortcode doesn’t work
- Calling shortcode in wp_localize_script strips result
- WordPress shortcodes & performance
- Is it possible to make shortcodes NOT case sensitive?
- Short code for Venues
- Layout shop page: resize images and columns
- How to add inline css/js inside a shortcode
- How extend shortcode default values for a plugin?
- Shortcode in AJAX popup
- Looking for a solution – slightly convoluted problem
- Can I use a Shortcode output as an HTML attribute value?
- WP theme with Backbone
- Can wp_localize_script be used within a shortcode?
- Force [wordpress_social_login] shortcode to display where it is embedded [closed]
- Custom CSS for plugin form
- Show history of post revisions on front end
- Shortcode based chart plugin
- Plugin shortcodes not working in custom theme
- tag breaks shortcode output (other solutions don’t work)
- Input with spaces in Shortcode attributes overwritten by defaults
- Allow users of my plugin to define their own shortcode rather than use mine?
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- Can someone please tell me what is wrong with my plugin?
- Trouble with editing template for “List category posts” plugin
- WordPress Shortcode to get URL Parameters $_GET[‘name’] redirects for no reason at all
- creating html reusable blocks via shortcodes
- add_shortcode is not working in plugin where others are working
- Single API call exposed via shortcode with params
- SEO Friendly URL on dynamic product page produced via shortcode
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- Insert content of a post into another
- Some code in shortcode function being ignored
- plugin shortcode output
- How to Create a shortcode to this php function
- What is @Action in WordPress?
- Use $_GET inside a shortcode print empty Array
- Render Modula Plugin Shortcode On Ajax Request
- Shortcode to update user meta
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- Deactivate JS Script in Plugin Shortcode
- plugin shortcode not working on ajax request call
- Shortcode not working after move wordpress website files
- Shortcode not getting replaced
- How to activate a plugin on the activation of a theme?
- Return multiple values in a shortcode attribute
- IF condition based on wp_remote_get output
- shortcode not return any thing in Gutnburg
- Shortcode Attributes to Return different $_POST
- Shortcode not working – quotes seems strange
- Get param from shortcode in plugin function
- Loop returns the current page’s permalink and guid instead of the post in the loop
- Inserting shortcode in href – any ideas or workarounds?
- Get Image Having the ID [closed]
- Add the_post_thumbnail_url to a shortcode in function.php
- Form Plugin for Api Requests which is used via Shortcode
- Echo out element to another page.
- Load CSS files in header of Bones theme?
- Adding a Tag Parameter / Filter to My Shortcode
- Filters on the_content with plugins, pages and shortcode
- Which is a better practice when writing shortcodes: pack lots of configuration parameters or just give an id?
- Help understanding dynamic endpoints based on where a shortcode is used
- How do I use a plugin’s shortcode attribute value in another function?
- Make the product page as homepage WooCommerce
- Shortcode show error while editing post
- Image path in childs theme
- Shortcode function not showing up on mobile browser
- Using Shortcode Result In Custom HTML Block (Using Google Sheet JQuery Result As NumScroller data-max)
- Get Current Post ID in WP Loop For GiveWP
- How to use plugin’s shortcode in custom design? [closed]
- Shortcode generated widget to appear on same line as heading text and button
- Page takes on two different formats
- WP Plugin CSS not being applied to page
- Sanitize AROUND shortcode
- Get not the full path
- Multiple calling javascript from shortcode in one page
- Sending post data over REST API, how to parse shortcodes in post_content?
- Query Shortcode from a multisite to appear on a different site?
- Is there a function to search for a wildcard value when calling a shortcode?
- shortcode which is introduced into entry the blog, and appears in side bar
- Space in WordPress Attribute Causing Problems
- Shortcode registered from a plugin not recognized
- Strange get_the_* behavior with php 5.4
- How to load a plugin when doing an Ajax call? [duplicate]
- Convert usernames listed by the Groups plugin shortcode to displayed names?
- Embedding BitBucket Code in Posting
- Do shortcodes affect page indexing by search engines?
- do_shortcodes() isn’t working
- How to show in front End images using Visual Composer attach_images?
- Seo Problems in My meta Discription [closed]
- I am experiencing difficulty fulfilling client request
- How can I get the permalink of a page on which shortcode has been used
- Buffered output in chunks and shortcode – how do I achieve that?