In your shortcode callback myshortcode_handler(), use a static variable:
function myshortcode_handler()
{
static $first_call = TRUE;
if ( ! $first_call )
{
# callback was called earlier …
}
# set it to FALSE after you have handled the condition.
$first_call = FALSE;
return;
}
Please do not misuse the global namespace for this: avoid constants, global variables and similar workarounds that might lead to unexpected conflicts.
Related Posts:
- How to customise the output of the WP image gallery shortcode from a plugin?
- How to include code only on specific pages?
- 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
- Cannot strip JW Player shortcode?
- How to pass multiple values in shortcode?
- append stylesheet via shortcode
- Calling function from within functions.php returns unwanted value
- plugin shortcodes not working on custom theme- unsure how to fix
- How to list all active and specific shortcodes in wordpress
- Plugin form unable to process
- Nested shortcodes
- Frontend editing, Frontend user dashboard
- Can’t get custom posts of taxonomy to show
- Plugin shortcode won’t work on a custom template file [closed]
- shortcodes displaying outside of content area with echo statement, not what I wanted [duplicate]
- 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
- Adding json as params to shortcode
- Shortcode is not working in homepage page template (custom front page)
- 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 add an automatic refresh in WordPress for a Page/Post or an embedded OneDrive/Excel HTML Code?
- 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
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- accessing wp.media api from a tinymce plugin
- Creating shortcodes in plugin
- Visual Composer shortcode for child theme dir
- Unable to add TAB character to post?
- plugin shortcode output
- How do I apply style to each category of a list?
- Anyway to convert a plugin to become a shortcode?
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- using do_shortcode
- Displayed content disappears when adding attributes to shortcode
- Modify page title and subtitle with a plugin
- How do I pass custom shortcode-extracted variables (taxonomy) into a query function for WordPress RoyalSlider?
- Flipping Book PHP Code? Any experience?
- shortcode – multiple instances of same parameter name in one shortcode instance
- Function call in wordpress short code handler fails
- strange shortcode error: does shortcodes requires any dependency?
- wp_localize_script not passing the data
- Get post content from outside the loop with plugin shortcode usability
- Is there any way to inject text onto pages?
- Create Short code dynamically
- Get variable value based on string constant
- Adding a Tag Parameter / Filter to My Shortcode
- grab or load text on demand
- How can I replace content on site generated from plugin without changing plugin
- 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
- how to display a template.php in a shortcode
- 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
- Shortcode do not return the right data in post
- Why does my custom plugin only function correctly once per page?
- JS working when used normally but not in wordpress
- WordPress Shortcodes – Return $Variable
- shortcodes not working [dt_carousel & [dt_fancy_image
- How to pass multiple custom fields as shortcode’s parameters
- Shortcode generated widget to appear on same line as heading text and button
- Do_shortcode before send email content
- Get shortcode attribute for AJAX call
- How to use a shortcode of a plugin in another plugin php file
- Bootstrap carousel – Using shortcode inside enclosing shortcode
- How to store multiple instances of the plugin’s options for various shortcodes
- Modify Plugin shortcode function code
- wordpress Shortocode running twice?
- Shortcode in a blog post, footer and related products stop working
- Using “excerpt_more” filter for a specific post type
- Allow user to input shortcode into wordpress widget
- Space in WordPress Attribute Causing Problems
- Shortcode registered from a plugin not recognized
- How to Set Limit with WordPress Get Bookmarks Shortcode
- Strip shortcode from excerpt [duplicate]
- How to use ‘Event Manager Shortcodes’ plugin via the php code? [closed]
- Next and Previous Pagination button not displaying in WordPress
- WordPress shortcode plugin not working
- WP Customer Reviews call short code on another page [closed]
- Shortcode returning specific content of a post
- 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