Need to move wp_get_current_user()
inside of the shortcode’s callback (untested):
function current_user_email_address() {
if ( ! is_user_logged_in() ) {
return '';
}
$user = wp_get_current_user();
if ( empty( $user->user_email ) ) {
return '';
}
return esc_html( $user->user_email );
}
add_shortcode( 'current_user_email_address', 'current_user_email_address' );
Related Posts:
- how to have the gallery shortcode output one single UL list instead of several DL?
- WordPress transients for a shortcode
- Get post id shortcode
- How to handle valueless attributes in shortcodes?
- How execute shortcode with javascript
- How to render complicated shortcodes
- Getting attribute value from shortcode
- My shortcode is not working in Contact Form 7 Message Body
- How to make this shortcode work for post content
- Get Shortcode Attributes
- How I make a shortcode for this code?
- Problem with email_exists in shortcode
- Shortcode doesn’t work with classes
- Get shortcode from the content and display it in other place (in sidebar, for example)
- Alternate text if shortcode returns no data
- sql query in shortcode not working
- Global, network-wide shortcodes or text replace functions
- Adding shortcode to the main menu
- Inserting PHP inside do_shortcode
- How to use div class between the shortcode variable?
- Error do_shortcode In WooCommerce Template
- Embedding Instagram via shortcode doesn’t work as advertised in official docs
- Executing a shortcode from a “normal” text/hyperlink
- Execute shortcode only once in the page
- Two different inner shortcode under shortcodes or multiple nesting of inner shortcodes
- Extra paragraph tags in an enclosing shortcode
- Order Woocommerce Products by Latest Reviewed
- $content not null in shortcode, even though it is self closing
- Nesting shortcodes results in the inner shortcode being placed AFTER outer shortcode
- Create a shortcode that creates a form for users to edit their information
- How to split text text text into array
- i have create shortcode that work but not perfect coding
- WordPress Vue Js Shortcodes
- Shortcode multiple values
- How do you stop a shortcode from firing in the editor?
- menu item to display the most recent post
- how to format / execute post content and shortcode?
- Documentation for adding a tinyMCE view for visual live preview of custom shortcode?
- How can I implement shortcode on click event
- Login form from shortcode doesn’t redirect after successful login
- How to list users by custom field?
- Form Shortcode not saving data to WP database
- Single post content custom order
- Adding a class to shortcode API
- Pass data back to TinyMCE from Thickbox
- Forcing WP to embedd a video when using a shortcode
- Shortcode for output of wp_get_archives displays at top of post
- How can I execute shortcode outside the loop?
- How to add “get_theme_mod” inside a shortcode?
- How to create shortcode to display perticular word from page title
- Shortcode is not returned correctly
- Echo HTML in custom shortcode
- How do I make a shortcode?
- Echoing Shortcode content inside the loop
- Do I need to escape number in this shortcode function?
- Short code inside the page not working in WordPress
- How can I list only custom shortcodes?
- Substite Category Slug in a Shortcode
- Add inline style to pages where shortcode was used
- add new attributes into existing shortcodes
- Anchor text in Short code →
- Theme Icons not visible on http://domain.com, works on http://ipaddress
- Shortcode to return an image based on post taxonomy
- How to pass an array as attribute of shortcode to work properly shortcode parser?
- How to show an image via shortcode
- Using shortcodes in the Site Title
- Use atributes of shortcode in get template part
- How to use multiple (or array) values in $content of shortcode?
- Is there any way to set the Featured image in wordpress post editor, using a Getty images embed code
- How to style inline code in block editor?
- Is it possible to capture the content outside/between shortcodes?
- Help with a function to create a shortcode
- How to use strip_shortcodes() from a spawned process?
- How to add new images to existing shortcode configuration?
- How to completely prevent WordPress from destroying/modifying my shortcode outputs?
- Term Description Echo or Return – display problems
- Same Shortcode not executing second time
- Check if Page=current user page via shortcode
- Is it inefficient to repeat a Shortcode 100 times on a page?
- tinymce custom button
- Running Filter or Shortcode Before Query Prevents Excerpt from Showing
- WordPress Payment link will not transform PHP vars into values
- Referring to site URL in shortcode argument
- Does a String Replacing script affect shortcode output?
- Shortcode for showing childpages
- How to create shortcode for auto login after registration
- How WordPress Displaying Shortcode In Post Content?
- Shortcode not accepting atts
- the_time function inside HTML dom parser
- Code auto escaping is not working when using short codes
- Shortcodes: Return different based on atts
- How to Convert Shortcode into a link?
- wp_register_script and wp_register_style when shortcode is used
- Wpautop stops working after get_the_excerpt
- Identifying first and last instance of shortcode in post
- Executing a shortcode at the top of PAGE template?
- Display a block conditionally based on user input button
- Custom shortcode with < in content
- Product description is mixed in shortcodes
- Why does my JavaScript work in the browser console but does not work in my shortcode?