You have to return html instead of echoing it. Buffer output withing your function and return it:
function shortcode_output() {
ob_start();
//get stuff from database
//format stuff
echo <<<FORM
<form method="POST" action="blah.php">
<!--more html-->
</form>
FORM;
$html = ob_get_contents();
ob_end_clean();
return $html;
}
Related Posts:
- Using get_option() in JavaScript
- Shortcode empty attribute
- Making a Shortcode [NEXT] and [PREVIOUS] to place into specific posts for post navigation
- How to display the site name in a WordPress page, or post
- How can I put a wp_redirect into a shortcode?
- Native “playlist” shortcode random playing… How?
- Stop strip_shortcodes() stripping content inside shortcodes
- Using audio shortcode for .mp3 URLs with a query string
- Get multiple shortcode attribute values
- How do i link gallery thumbnails to different url’s using the wp native gallery?
- Why do_shortcode is not executing the shortcode in data-* html attributes?
- How to save a shortcode in a Gutenberg custom block?
- Is shortcode_unautop() broken?
- Some doubts about gallery shortcode in WordPress
- has_shortcode for content added after the content
- Dynamically create shortcodes using add_shortcode and a callback
- Creating a Slider Shortcode Based on Nivo Slider
- How can I make a shortcode from this code?
- Meta tags in shortcode
- Adding PHP/HTML code inside page from custom template
- WordPress auto adds p to shortcode parameters
- Why isn’t this youtube shortcode working?
- Gist shortcode is not working
- ShortCode and extra
- How to change page title (from a plugin) in twentytwentyone theme
- WordPress Code Standards and Working $link Parameters In Shortcode
- How to set Contact Form 7 fields default value using shortcode attribute? [closed]
- shortcode get thumbnail size
- Shortcodes Keep Wrapping in
- Check if post has gallery images/media
- Shortcode to delete post from front end
- MathJax inside shortcode
- How to parse shortcodes within returned content
- Hook WP_Embed run_shortcode
- Change WordPress Shortcode added in to post
- Shortcodes attributes defaults
- Get Required Assets (JS, CSS etc) for post using REST API
- shortcode in snippet plugin not work
- AJAX and Shortcode with Parameters
- Remove ‘p’ tags around shortcodes and ‘img’
- WordPress Short code with additional parameter
- How to protect parts of my code from TinyMCE modification when switching from text to visual mode?
- Responsive Embeds using default embed shortcode
- Creating a short code with php inside
- Shortcode output appearing at the top of the page only [duplicate]
- problem with shortcodes nesting
- OOP and WordPress shortcode
- PHP/WordPress — How do I check if Shortcode returns content?
- Convert my php code into shortcode
- Add shortcode with open close function
- Shortcode is not working
- Will a shortcode placed inside a paragraph tag still be valid?
- Why can’t I display attachment_image_src with Custom Size?
- Get attributes of nested shortcodes
- Shortcode Strategy
- Enclosing Shortcode is acting like self-closing
- Shortcode into the same shortcode
- Change user meta value with shortcode
- Execute shortcodes in PHP
- A shortcode nested inside a shortcode
- WordPress User ID as Shortcode
- Custom Shortcode + Querying and Ordering Posts using multiple Advanced Custom checkboxes
- call other shortcode in the email contactform7 send [closed]
- Putting a space between the buttons [closed]
- Dynamic number within shortcode
- How can i strip shortcode from HTML title tag?
- Need help with creating a simple shortcode
- Returning HTML to Shortcode Block
- WP REST API remove the WordPress shortcodes from the JSON wp/v2/posts content->rendered
- How to display html element and php string in the same line?
- Hide download option video shortcode
- WordPress Shorcode Display hierarchical taxonomy [child, parent]
- Shortcode not working in Jetpack Top Posts & Pages widget
- Restricting shortcode for users
- Gutenberg running code only available in front end within shortcode
- Insert HTML in content property and render it using shortcodes
- Redirect per shortcode if user is logged in
- Shortcode, vs blocks, vs templates – what would you do for choosing or creating custom post data in editor?
- Shortcode Attribute not defined
- Convert WordPress shortcodes into plain html
- Attributes are not passed on nested shortcode
- Second attribute of shortcode is not changing why?
- How to make a shortcode with a line break in it parse correctly?
- Plugin Shortcode value in post
- Woocommerce Filter Main Loop by Tag [closed]
- Shortcodes: override a shortcode / change shortcode on the fly
- Access the resized images generated by `add_image_size()`
- Separating Custom Template logic
- woocommerce Product shortcode create [closed]
- A number appears inside a div called wpb_wrapper, when I use a custom shortcode
- Enclose article’s body with default shortcode
- Shortcode Site include in a other
- Why is my ajax live search not working when i use a shortcode to call it?
- Shortcode with foreach
- How do write this type shortcode? [closed]
- WordPress functions.php shortcode is not working [closed]
- My first WordPress shortcode just returning []
- WordPress shortcode select option not working [closed]
- How to exclude some cats from wp_list_categories using shortcut
- How can I create a shortcode that shows a list of categories on the single product page?