A shortcode has to return just a string, you should not print something like in wp_list_pages()
or echo
. From Shortcode API:
The return value of a shortcode handler function is inserted into the post content output in place of the shortcode macro. Remember to use
return
and notecho
– anything that is echoed will be output to the browser, but it won’t appear in the correct place on the page.
Related Posts:
- Show shortcode without executing it
- How to create a shortcode with 1 parameter (atts)
- shortcodes output before content [duplicate]
- How does a shortcode work?
- Remove wptexturize from a shortcode?
- Using shortcode in Post title
- WordPress adds br in between my shortcode
- Audio or playlist shortcode condition according to the amount of files on attachment page
- WP_enqueue_script inside shortcode?
- Shortcode to Gutenberg-block: additional text on front-end and conditional display
- template_redirect to accompany with a shortcode
- How navigation works in custom loop within shortcode?
- Tinymce shortcodes within shortcode contents
- passing multiple parents value into a shortcode
- How do I preview the result of a shortcode in the TinyMCE editor?
- Conditionally loading Facebook PHP SDK in shortcode
- WordPress shortcode doesn’t working on HomePage
- Why are Shortcodes Disabled in Widgets by Default?
- Add attribute to shortcode dynamically
- Execute shortcode twice in the same page
- How to parse this shortcode?
- Add custom setting that uses radio button to WP Gallery
- Shortcode with hyphen doesn’t work
- Shortcode parsed incorrectly because of heredoc
- WordPress Gallery shortcode: Display one category ID only
- How to get gallery id inserted to a post?
- WordPress Shortcode show database row
- Shortcode “post_per_page” not working
- Shortcode is running in page editor
- Creating shortcode with parameter
- Shortcodes won’t work on live environment
- Create shortcode in Child Theme?
- Get post object in shortcode function
- How to insert image and text from admin panel throughout my theme
- Create a short code to display a specific loop
- How to add shortcode to HTML file (not showing on website)
- Custom Shortcode: define cursor position/insertion point?
- How to wp_redirect on ‘init’ hook on condition of current post id?
- Buddypress shortcode for tabs [closed]
- show shortcodes in editor
- Image Shortcode from ACF ID
- Page code showing in WP Dashboard
- echo do_shortcode just prints the shortcode name and not its content
- How to create a shortcode with html and php code
- PHP Running On CMS Side of WordPress
- Insert shortcode between ”
- do_shortcode doesn’t work on some pages
- Custom youtube shortcode that uses $content
- How to build dynamic pages?
- When are Shortcode Attributes Available in Template
- How to reload the shortcode content when the database is changing
- Regenerating WordPress shortcodes based on value with AJAX
- Custom shortcode to display posts, first post is full
- Form shortcode with multiple options as attributes
- How to add data attributes to the wordpress audio shortcode
- Beginner’s question about shortcodes
- Shortcode inside text widget do not call enqueue style
- How to create a dropdown of shortcodes in edit mode for posts
- Multiple instances of the shortcode on the same page
- do_shortcode() won’t return PHP Array
- get data with shortcode
- Replace shortcode with output in database?
- Wrap php in shortcode
- Excerpt Length & List Category Posts Plugin
- Iteratively add sub shortcodes to php array
- Show shortcode only in posts
- How to execute a shortcode?
- Shortcode, Concatenating & Parse error: syntax error, unexpected T_FOREACH
- get_queried_object_id / short code returning blank
- Getting Shortcode Attributes befor content is displayed by the template
- How to remove double quotes in a shortcode?
- Shortcode to appear and show the date not code in Title and description of my website
- Colon is Missing In My Website Url in WordPress Shortcode
- Shortcode not working inside div html
- shortcode to display specific recent posts
- How to test If a post has a particular term
- Multiple shortcodes with embedded JavaScript code in same page, how?
- Contact Form 7 shortcode is commented out, but I receive spam emails from it
- Multiple values for one variable
- How can I disable(remove) wpautop (wptexturize, convert_chars) for specific shortcodes only?
- How to load specific template page in a custom shortcode
- WordPress keeps automatically inserts
- shortcode is not rendered
- Impossible to display modification in shortcode code?
- Contact form code not working. Need help!
- How to make shortcode enabled in JSON Feeds?
- Ajax callback and shortcode functionality
- Automatically add class-attribute to gallery?
- Shortcode works from functions.php but not from included file
- Duplicate short code duplicating some values only
- Why can’t I type [ ] opening and closing brackets on the Visual tab?
- Video Shortcode Only Returning a Link
- Loading shortcode stylesheet only when shortcode is in text widget [closed]
- Members only Passthrough
- How to add a nested shortcode into editor?
- load plugin with ajax [duplicate]
- Can not get shortcode content in function
- Free Add to Cart Button on WooCommerce with Elementor – No Premium [closed]
- wordpress shortcode url decode non Latin character
- Shortcode return vs echo. Return messes with data URLs, echo does not