@WebElaine is correct. I had to use the wp_get_current_user();
and remove global
.
This is what worked for me
function download_to_wallet() {
$current_user = wp_get_current_user(); // get current user's information
$qr_url = $current_user->qrbase_code_pass_url;
return '<a href="'. $qr_url . '"><img class="qr_download" src="https://example.com/wp-content/uploads/2018/08/add-to-apple-wallet-logo.png" style="width:200px;"></a>';
}
Related Posts:
- How to display some selected user meta data on a specific page with a shortcode?
- How to list users by custom field?
- Change user meta value with shortcode
- Parsing a shortcode through an author meta textfield
- SImple Example To Update User Info From Front End [duplicate]
- How to display content if user meta data isn’t empty with shortcode
- 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?
- Shortcode for displaying the user’s first name?
- the_excerpt and shortcodes
- Get current post id witout passing in shortcode
- Autoembeds don’t work with paragraphs
- Get all posts containing a shortcode
- Videos via the video shortcode are always 640px wide?
- Custom Shortcode and Button not Working after 3.9 update
- Hide Default Video Shortcode Controls on PageLoad
- How to: How do I make my own shortcodes without plugins?
- Change font-size within a shortcode
- How can I show the Jetpack Subscriptions form in a page? [closed]
- Splitting Shortcode Attributes not working
- getting values from a shortcode with an include
- Create a shortcode in WordPress, again
- gutenberg widget outputting paragraph marks
- How to make shortcode output display where I choose
- Add Shortcode to a Div or Header [closed]
- Change link in get_terms if there is only one post in the category
- How to get total number of shortcodes in the wordpress application?
- 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]
- How to use shortcode in js url
- Nested Code Snippets [closed]
- How do I display “Hello username” if logged-in on the homepage
- Adding a Cookie Session to Shortcode Content
- Shortcode to show current post category with link
- Gutenberg Block with Select from JSON-File
- Shortcode function executed twice?
- How to register a user via modal after clicking a link in the shortcode?
- 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
- Shortcode to update user meta
- WordPress messes up with data attributes in shortcode output
- Displaying audio player as preview in audio post in WP3.6
- How to transform WordPress user role code to WP shortcode?
- Shortcode don’t work in custom option field, any solution?
- Slow page Loads When Using Dynamic Coding
- Does short-code slow down my WordPress site?
- redirect if shortcode exists
- Position shortcode off [duplicate]
- Query to list all galleries under a parent post?
- ob_get_clean(); doesn’t return $value in shortcode?
- 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
- Adding YouTube button to TinyMCE editor
- 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
- Echo Extra Shortcode HTML to wp_foot
- 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
- 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?
- shortcode is not rendered
- Impossible to display modification in shortcode code?
- Contact form code not working. Need help!
- Use Shortcode on Custom Page
- WordPress Database Error using $wpdb->get_results()
- 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]
- Shortcode with multiple variables
- Can’t get default values to work with custom shortcode
- Can not get shortcode content in function
- How create a shortcode with html
- Adding shortcode [closed]
- do_shortcode autommatic content generation
- Using $variable in shortcode
- Free Add to Cart Button on WooCommerce with Elementor – No Premium [closed]
- wordpress shortcode url decode non Latin character