According to @Mark Kaplun comment:
Make your getRandomCode() return value instead of echo like this
function getRandomCode(){
$alphanumeric = "0123456789abcdefghijklmnopqrstuvwxyz";
$su = strlen($alphanumeric) - 1;
// echo '<br/>';
// // echo rand(0, $su);
// // echo '<br/>';
// // echo substr($alphanumeric, rand(0, $su), 3);
// // echo '<br/>';
return substr($alphanumeric, rand(0, $su), 3) .
substr($alphanumeric, rand(0, $su), 2).
substr($alphanumeric, rand(0, $su), 1).
substr($alphanumeric, rand(0, $su), 1);
}
and remember do not make change to your shortcode callback
Related Posts:
- Shortcode to insert
- Shortcode putting html such as
- How to return a string that has a variable inside in a shortcode?
- Using Echo in ShortCode – Stuck
- Passing a shortcode attribute to a sub-function
- Multiple do_shortcode($content) within one shortcode
- Adding Image Count to Multigallery
- My shortcode is showing up twice
- Custom plugin issue when trying to use the shortcode twice on a page [closed]
- WordPress menu deletes when trying to add a hook
- How to find the output of contact form 7 shortcode? [closed]
- How do i get (unique) page name?
- Can A Shortcode Get HTML/Text From Content And Return It Twice With Added HTML?
- Browser title script ignoring is_page /else conditional [closed]
- Nested shortCode functions in the functions.php file
- get_page_by_title with an apostrophe in variable
- Making Quote Plugin more efficient
- How to limit the content coming from wordpress shortcodes?
- How can I get content inside one shortcode to another shortcode?
- is_page “range” for if statement?
- Use WP_Query in shortcode
- Custom Theme, Custom shortcode not working
- Different loop output every x posts in custom post type
- Showing content from one page on another
- Showing a different gallery in a seperate post
- Create own WordPress shortcode gallery
- How to exclude category ID from Looper in WordPress
- Add a specific part of current category page url to shortcode
- Calculating a large number of MYSQL queries as customshort codes, slow
- WordPress Shortcodes.. printf is outputting a random number… Can’t figure out WHY?
- How to use wp_add_inline_style for custom CSS added via shortcode?
- How can I dynamically update the class in my shortcode?
- Displaying recent posts on static page with template-part via shortcode
- How to Reference/Echo Variable from Another PHP Function
- Replace shortcode in substring
- Only first shortcode gets executed
- echo something inside a shortcode
- displaying content that includes shortcodes within an echo
- List taxonomy term slugs within shortcode (do_shortcode)
- Display Data in Table from External Database in WP using Shortcodes
- anyway to put inside a $outprint=sprintf()
- Capitalize Shortcode Value on Output
- Why is my str_replace not working on short code submitted by front-end?
- Shortcode not staying inside div tag
- Line breaks inside shortcode variable
- Shortcode for Listing Users from Meta Value?
- Shortcode to pull posts
- Help Fallback (thumbnail)
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- Shortcode to log user into current URL
- Shortcode function doesnt work without caption
- Calling PHP Titles inside Javascript Markup
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- Change Spaces to Dashes?
- Including Custom fields within the_content
- What is the difference between Null vs Empty (Zero Length) string?
- Show Featured Image Dimensions and size frontend with shortcode
- How to work Woocommerce pagination inside shortcode?
- using shortcodes inside gravity forms
- How to Create custom block for displaying information in content section which act like shortcode
- Display logged in user name and lastname on page
- Display Visual Composer shortcode if a post belongs in specific categories
- is it possible for a URL to filter by tag
- Trying to create a shortcode to display categories with a specific product tag
- How to pass parameters in wordpress shortcode?
- Replace background image with post thumbnail in shortcode
- How can I prevent a shortcode div from extending beyond its boundaries?
- Conditional formatting on data fetched from MYSQL
- Adding variable in WordPress shortcode
- Display a custom name when the user has no name settle in his account
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Execute Shortcode in Textfile
- custom taxonomies not working
- How to use Contact Form 7 shortcode value in a page?
- Display current user metadata on WordPress page
- Add Shortcode to ::before class
- Reload page with a different shortcode when a user selects from a dropdown
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- How to output values from a loop into a javascript array
- Shortcode’s output to use as other shortcode’s parameter
- Show products per shortcode
- Short code into PHP
- Add two or multiple functions in WordPress Post or Page
- Shortcode Works for Logged in Users but Not Working for Guest
- perform mathematical operation on shortcode
- Update same content in multiple posts at once?
- problem multisite with blog id
- Shortcode At top of Page – PHP 5.5 vs 5.4 – ob_start();
- Create dynamic content from one WP page to multiple other pages
- Shortcode Display From WordPress Dashboard Page Without Using post_id
- Do_shortcode on PHP file outside theme ALMOST works
- Using the same shortcode to show any table from the database
- Shortcoding with Divs
- Custom Shortcode with Dynamic Button
- Whats wrong with my code? Need To add String to shortcode? [closed]
- Shortcode for Visual Composer Grid fails turning string to integer
- Is there a better way to output HTML as a shortcode?
- Gutenberg – render_callback does not pass ToggleControl value on frontend
- How call WordPress shortcode inside function file
- Show Login Errors In WordPress/Elementor (Code “works”, but breaks site)