This is wrong:
$emailaddress = the_author_meta('user_email',$author_id);
the_author_meta()
will output the value as soon as it’s run, which is above everything else. If you want to put the value into a variable to echo later you should use get_the_author_meta()
:
$emailaddress = get_the_author_meta('user_email',$author_id);
The convention in WordPress is for functions beginning with get_
to return
the value, while functions beginning with the_
to echo
the value.
Related Posts:
- How to add product in woocommerce with php code [closed]
- Uploading media with the REST API
- Show the most popular post per week
- Add a class to links in the visual editor (how to get old dialog back)
- Creating custom Woocommerce attribute taxonomies from a plugin
- Add extra field to users
- Enable/disable post revisions programmatically
- Passing JSON data from WP Query into AJAX causing NULL errors
- How to redirect users to custom lostpassword page?
- Get post meta in enqueued js file
- Can I write ‘RewriteCond’ using ‘functions.php’?
- Multiple do_shortcode($content) within one shortcode
- Index showing source code
- Use WordPress Text Editor in non-wp page
- StudioPress: add meta tag to every page [closed]
- How to add specific menu on a specific page or pages
- How do I get URL from WP_HTTP object?
- Overriding a theme redux file in child theme
- Validate a users email address when using gmail to register
- Advanced Custom Fields Image Field returning ID instead of URL [closed]
- How can I add a specific, custom widget to my theme’s header.php?
- How do i get (unique) page name?
- selected menu item
- How to attach a uploaded video to post from front end
- How do I use the Simple HTML DOM Parser in plugin when other plugin already uses it?
- How to add a second ‘place order’ button in WooCommerce [closed]
- Overriding WP login credentials
- remove wp floating submenu in wp dashboard
- ACF: how do I get the fields and its values of a specific group?
- Add a product to checkout via form
- Posting and image insertion problems after EasyApache4 and PHP 7 upgrade
- Find exactly what php files are responsible for each php process
- Remove from shortcode
- WordPress Multiple Navigation bars
- Login to wordpress by clicking a link and specifying usernaname and password in url
- $wpdb->insert() does not Insert record in a table
- How to change menu labels
- Syntax error when I try to insert my loop into an unordered list? [closed]
- What exactly do this function declared into functions.php file of a WP theme?
- How can I call specific function if requested URL is not found?
- How to check if a Customizer setting is set?
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- Printing HTML codes
- How to overwrite orderby with add_query_var
- Get latest post from all categories except one
- Capitalize Shortcode Value on Output
- how to Update 15k products on plugin activation with meta_option
- exchange words in echo
- Co-Authors Plus: How do I get all authors with a query?
- Ajax search shows all results when user empties input?
- get_header_image() causes “Prioritize visible content” issue in Page Speed Insights
- How to reference PHP in Javascript
- Create Div Wrapper On 3rd Iteration Or When Query Loop Items Run Out
- How to get the slug of the homepage when editing it in WP admin?
- wordpress admin part is not accesbile after server shifting
- Post ID wrong in Functions.php
- How to forbid users to change their first, last and screen names?
- Using PHP Code Snippets to query a database, $dbconnection->get_results is outputting nothing
- How to assign page id with array in page_scheduled_event
- html form: redirect page after form completes submit function and posts data
- Include custom fields in search
- WordPress Custom Form – Getting Query Vars, Weird Glitch?
- Creating plugin with front-end pages
- Storing huge number of users in wordpress
- Adding Custom css file in the wp-uploads directory with custom php functions
- Form from within a page
- How can I edit a php custom page template to work in other themes?
- How to add a DELETE button to the “Edit User” WordPress admin page?
- Cannot dequeue Elementor Font Awesome css
- How to find and delete a menu item in php?
- Using zip code to display custom data in Admin Order Details
- Automatically delete posts one by one depending on published time
- Following/Followers Users list Using Ajax Pagination inside Author Profile
- Why should I need to add init action to include PHP file to WordPress Plugin?
- Dropdown menu on custom menu
- Pagination in WP Queries
- Display product_brand with get_the_terms function
- How to fix the loop statement
- How can you disable search for non-members on your WordPress website.
- Query Posts from Custom Field Value Taxonomy Set by Admin
- Custom Thumbnails [closed]
- WordPress error on my website
- Limit Taxonomy Parents
- Migrate php folder to WordPress
- Enabling XSendFile causes 404 for images on WordPress Multisite / Network
- How to add feature image url in my template file and content as well?
- Trying to post information from a remote database to wordpress page
- How to add button to top of theme customizer?
- WP white screen of death after duping a site that works fine on same server
- How can I list only Subcategories in Woocommerce
- PHP Call to External Database
- echo vs output variable [closed]
- Display Post Titles on top of the_post_thumbnail()
- Options.php loop won’t show!
- Critical Error customiser
- Alternative to php echo within code
- Add multiple HTML attributes to an Elementor button
- Why does WordPress not send the user the email to add a password?
- How to put a class in the p tag automatically added by the_content() in the wordpress loop?
- How to sort custom sortable column by custom table value