I just tried your exact code, putting the PHP code you pasted above in my theme’s functions.php
file, and inserting the shortcode as you typed [sc id="81"]
in to a page in my site, publishing the page, and it correctly outputted a value of 81
on my published page.
So something in your theme or a plugin must be conflicting with it.
Try changing to one of the default WordPress themes and testing it again, and/or disabling your plugins.
I suspect it could be a conflict because the parameter is named ‘id
‘ – so you could also try using a different parameter name (eg. ‘myid
‘).
Related Posts:
- Conditionally Loading JavaScript/CSS for Shortcodes
- Pass boolean value in shortcode
- Escaping quotes from shortcode attributes
- How to add ‘class’ attribute into shortcode [audio]?
- Automatically add this attribute to the gallery shortcode
- How to handle valueless attributes in shortcodes?
- Get multiple shortcode attribute values
- wpautop() when shortcode attributes are on new lines break args array
- Remove width and height attributes from [gallery] output
- Add attribute to existing Shortcode
- Extending Shortcode attributes
- Remove HTML content if attribute is not set / variable attributes
- Global, network-wide shortcodes or text replace functions
- getting values from a shortcode with an include
- Why are Shortcodes Disabled in Widgets by Default?
- Add attribute to shortcode dynamically
- Replace / Remove Shortcode after 1st run / post
- Caption shortcodes not including caption as attribute
- Conditionally Loading JavaScript/CSS for Shortcodes
- Check if CTP category taxonomy is set in shortcode
- Passing variable in nested shortcodes
- How to use a nested shortcode to render the value of an attribute in parent shortcode
- Which wordpress function is the caption shortcode linked to?
- How to process a single attribute in a SQL request twice times?
- shortcode atts not working
- Second attribute of shortcode is not changing why?
- Replace custom gallery shortcode with default gallery shortcode
- Shortcode Attribute contains clone of all shortcode attributes
- How can I define the output of shortcode attribute value?
- Remove width and height attributes from [gallery] output
- how to have the gallery shortcode output one single UL list instead of several DL?
- Get post id shortcode
- How execute shortcode with javascript
- Getting attribute value from shortcode
- Get shortcode attributes outside shortcode function
- How to make this shortcode work for post content
- How I make a shortcode for this code?
- How can I get the current user email instead of user ID?
- Shortcodes output in the wrong order
- How to link to a page that has a shortcode?
- Adding short codes from a page’s content on header and hiding the same from page’s content
- Should I cache default WordPress gallery shortcode output?
- How to load shortcode sooner
- Tinymce list of shortcodes button
- Add page title as a javacript variable to specific posts
- How to create a shortcode for custom page template
- How to add and submit input fields using a shortcode?
- How can i remove the paragraph from shortcodes content?
- Pass javascript array to shortcode
- Shortcode not working with WordPress updated
- WordPress Shortcode callback function with a plugin
- Input with spaces in Shortcode attributes overwritten by defaults
- Saving post content to database with do_shortcode?
- Is it important to sanitize inputs in a shortcode that will be used in site that only I will post to?
- Shortcode Function not working
- Using shortcode to display array in array
- Add the last viewed post title to a contactform with shortcode [closed]
- Custom recent-posts shortcode’s thumbnail image not in line with rest of code
- Adding a template part as part of a shortcode
- Just display content between shortcode brackets
- How can i share codes on my blog?
- Using the title of the post in a shortcode
- wordpress shortcode not working
- PHP Helper Class to create shortcodes
- Change variable value for different shortcode attributes?
- How to copy [gallery] shortcode between posts using polylang [closed]
- Shortcode not displaying video as expected
- How to add a shortcode that creates an adjacent column of text in the content editor?
- Template not loading with get_template_part or locate_template
- How to Display Shortcode’s Content after Short Product Description?
- Check if parent page has child page of certain slug
- Jetpack gallery shortcode with slideshow
- Shortcode atts for WP Query args
- Remove figcation from excerpt
- wp.blocks.registerBlockType not showing what I want on the frontend
- PHP not outputting the onclick in anchor tag
- Create Button for Shortcode in Text Editor
- Send Mail with link to current_user
- how to edit woocommerce checkout page
- Geoip shortcodes in comments
- Shortcode not interpreted if parameter set
- do_shortcode for is_page(slug)
- Create shortcode to display specific post in relationship current date
- Add custom shortcodes to the Welcome Mail
- How to handle multiple nested shortcodes with different tags?
- Using shortcode to stop post content from displaying
- Nested WordPress Shortcodes of Different Types
- Initialize add_action() for every copy of a specific shortcode
- WP_Editor Shortcode Issue
- Shortcode not working in custom post types
- Shortcode or placeholder for theme options page?
- Shortcodes that are created based on user input information
- Remove some tags from shortcodes output? Trying to fix autop
- do_shortcode & render custom field won’t work
- shortcodes inside shortcode to sum values
- is_mobile as shortcode
- How to attach sidebar to shortcode’s output?
- Is it possible to change a shortcode parameter based on a media query?
- IFrame Shortcode plugin – issue
- 3 shortcodes 2 won’t render [closed]