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:
- How to customise the output of the WP image gallery shortcode from a plugin?
- Custom media upload content for inserting custom post shortcode
- Checking if an attribute exists in a shortcode
- Shortcode output appears before post body [duplicate]
- PHP Deprecated: Non-static method should not be called statically
- Loading shortcode with ajax
- How to call shortcode function directly and pass $atts
- How to pass multiple values in shortcode?
- Calling function from within functions.php returns unwanted value
- plugin shortcodes not working on custom theme- unsure how to fix
- Plugin form unable to process
- Nested shortcodes
- Frontend editing, Frontend user dashboard
- Can’t get custom posts of taxonomy to show
- Trying to count the total number of paragraphs inside a blog article
- How Can I Pass the Shortcode’s $atts Variable to the Plugin’s Javascript Function
- May i Use ShortCode in Template?
- Pass variable to nested shortcode
- Add custom variable in Contact Form 7 mail body
- get shortcode value
- Storing Options in a Shortcode
- Prevent shortcode from being wrapped in tags
- How can I create a custom shortcode that will return a custom post type by ID?
- Plugin Handle URL With Custom Theme
- AddToAny shortcode in the loop
- How to fix wrong attribute error for Visual Composer Grid Builder?
- Making a Template for a CPT created by a plugin
- Shortcode Plugin to dynamically build a shortcode via `do_shortcode` not working
- Creating shortcodes in plugin
- Unable to add TAB character to post?
- plugin shortcode output
- How to Create a shortcode to this php function
- How do I apply style to each category of a list?
- What is @Action in WordPress?
- Use $_GET inside a shortcode print empty Array
- Where are theme codes located for WordPress?
- Render Modula Plugin Shortcode On Ajax Request
- How to have sample page for each new register users in a membership website
- using do_shortcode
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- plugin shortcode not working on ajax request call
- Modify page title and subtitle with a plugin
- Shortcode not getting replaced
- How to activate a plugin on the activation of a theme?
- Add Shortcode tag in Widget/Sidebar
- WPTouch – how to remove shortcodes or make shortcodes function
- Custom shortcode for displaying user based on a role parameter
- WordPress Plugin Insert Html Code with Shortcode
- 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 all the URLs of the pages that uses a specific shortcode
- Get param from shortcode in plugin function
- 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?
- how to check if a shortcode is used more than one time in the same post
- 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?
- Rename Smart YouTube’s httpv back to http for all posts
- How to use a shortcode or an application to dynamically embed content from one WordPress site to another?
- Managing and deleting transients with dynamically generated transient names
- Thumbnail image doesn’t show up in Shortcode output
- list of custom post by custom field in frontend
- get_post_meta shortcode returns empty field
- How do I use a plugin’s shortcode attribute value in another function?
- JS working when used normally but not in wordpress
- Make the product page as homepage WooCommerce
- Image path in childs theme
- WordPress Shortcodes – Return $Variable
- Shortcode function not showing up on mobile browser
- shortcodes not working [dt_carousel & [dt_fancy_image
- Get Current Post ID in WP Loop For GiveWP
- Shortcode generated widget to appear on same line as heading text and button
- Page takes on two different formats
- Sanitize AROUND shortcode
- Get not the full path
- Sending post data over REST API, how to parse shortcodes in post_content?
- wordpress Shortocode running twice?
- Shortcode in a blog post, footer and related products stop working
- shortcode which is introduced into entry the blog, and appears in side bar
- Using “excerpt_more” filter for a specific post type
- Space in WordPress Attribute Causing Problems
- Shortcode registered from a plugin not recognized
- Strange get_the_* behavior with php 5.4
- Strip shortcode from excerpt [duplicate]
- Embedding BitBucket Code in Posting
- Next and Previous Pagination button not displaying in WordPress
- Do shortcodes affect page indexing by search engines?
- How to show in front End images using Visual Composer attach_images?
- Seo Problems in My meta Discription [closed]
- cURL External API request displays content above other content on page
- Beginner question: Accessing js script in plugin
- thumbnail_width not working in wordpress most popular post plugin
- Display file contents within Plugin