In general, if arguments is not used or the defaults values are to used of an argument/parameter, you don’t have to write it out, they can simply be omitted. The only time when you have to pass any value to an argument is when a function expect a valid value to be passed to it in order to properly execute, something like get_terms()
which expects the first argument to have a valid taxonomy value
In your example, using shortcodes, it is not necessary to pass $atts
as you are not expecting any values from attributes and you have not set up any attributes inside your shortcode function. Your shortcode simply returns a static value. In a case like this, you can simply just omit $atts
Related Posts:
- Custom shortcode being executed when saving page in wp-admin
- Change appearance of shortcode text inside editor
- Shortcode outputs at the top of the_content
- Shortcode output always showing at top of page
- Short code to display a loop
- How can I just get content inside a shortcode or just outside
- Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]
- WordPress core responsive video not working with shortcode
- WordPress gallery ‘post_gallery’ filter doesn’t work with feeds?
- shortcode to create dynamic dropdown box form shortcode attributes
- Ajax not returning anything on form submit
- How do I add my own custom shortcodes?
- Can’t seem to get [shortcode]s to work
- Simple contact form with field validation
- Slow page loading when using a simple shortcode on the same page multiple times
- TinyMCE get selected text and underlying HTML
- Remove and restore one shortcode
- Using do_shortcode with variables?
- Using ACF field in do_shortcode()
- Display content from another site page using a shortcode
- WordPress display image link in shortcode
- shortcode_atts – one URL variable not working
- Caption shortcodes not including caption as attribute
- stop shortcode stripping in category and archive pages
- Passing a nested shortcode as an argument of another shortcode?
- How does one insert a variable value into a “myCRED plugin shortcode [closed]
- Enumeration Contact form using database table’s numbe of rows [closed]
- Nested Code Snippets [closed]
- How do I display “Hello username” if logged-in on the homepage
- Adding a Cookie Session to Shortcode Content
- Gutenberg Block with Select from JSON-File
- Shortcode function executed twice?
- add widget to page content (using shortcode)
- Pagination for a page created by the shortcode “Product”
- Freeze a shortcode in place?
- Unable to the get the gallery inserted between shortcodes
- wp_editor in thickbox
- Complex Slider Shortcode Help
- How to use the same shortcode with different attribute values on same page
- WordPress messes up with data attributes in shortcode output
- Displaying audio player as preview in audio post in WP3.6
- WordPress post pagination continuous [duplicate]
- custom field value as shortcode parameter
- Shortcode don’t work in custom option field, any solution?
- Slow page Loads When Using Dynamic Coding
- Can I use shortcodes in mail body
- redirect if shortcode exists
- Position shortcode off [duplicate]
- Query to list all galleries under a parent post?
- Adding the username into a URL to redirect to a specific page
- Shortcode Help Needed → attributes
- Video Shortcode & Video Poster Question
- Ordering get_terms with ACF not displaying all terms
- How to Get Shortcode in Excerpt to follow Document Flow
- Cant fix this Warning: Invalid argument supplied for foreach() in [closed]
- Different ID in every shortcode
- Unique ID for WordPress shortcodes when used more than once on a page?
- How to find out what handler is registered to a shortcode
- How to display NextGEN gallery in templates?
- jQuery Tabs in Shortcode API
- Build Clickable Link Using Multiple Attributes
- Using Shorcodes in Sharing Preview and Notifications Title from Post Title
- How can I use a plugin shortcode inside of a html form?
- Is the WP audio shortcode still relevant?
- Disable wpautop on Shortcode attributes
- remove shortcode pagination for specific url referrer
- Third-Party API – PHP Fatal Errors Paired with http_request_failed / cURL error 28
- If statement shortcode
- Shortcode PHP file for two conditions passed when do shortcode
- Using within a shortcode
- Shortcode not working when I output data from wpdb html table row
- How do I point bloginfo(‘stylesheet_directory’) to my parent theme?
- Gallery shortcode is empty but magically creates a gallery
- Add audio file to post using custom term meta field as link [closed]
- How to avoid one code multiple times instead do that through some function? Shortcode, but I think shortcode is not used in main theme’s core files?
- How to list child pages with excerpts, e.g. [child-pages depth=”1″ excerpt=”1″]
- Add a shortcode in woo-function.php
- Get current category and place it in shortcode
- Woocommerce products shortcode specific order
- Modify Blog Module layout in Child theme
- Video shortcode outside WordPress not working with IE and mediaelement’s Flash fallback
- Display title of child pages in shortcode
- Output html source tags inside shortcode
- How can I define the output of shortcode attribute value?
- Using shortcodes that wrap around code
- What is the best way to include a template file within a shortcode?
- Shortcode templates
- Create plugin/function to catch XML-data via Shortcode
- Why My slider shortcode display above header
- Does anyone recognize shortcode ig_special_heading?
- How to scroll to a shortcode-generated anchor
- add post type pram to wp shortcode
- Shortcode conversion to hrml when post is published
- Shotcode error on functions
- Shortcode for displaying the user’s first name?
- Can I prevent wordpress adding and tags to autoembeds
- Shortcode – Display inline icon before text [closed]
- Working with Shortcode, AJAX, Elementor
- 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?