Because the $current_user object doesn’t have a property called user_nickName because the user nickname is stored in the user meta.
$user = wp_get_current_user();
$meta = get_user_meta( $user->ID );
$nickname = $meta->nickname;
Or
$nickname = get_user_meta( wp_get_current_user()->ID, 'nickname', true );
Related Posts:
- How does printf( __( ) ); work?
- Return HTML Template Page with PHP Function
- Why do templates contain so many PHP tag pairs?
- Displaying Logged-In User Name in WordPress Menu
- Is there a way to parse shortcodes in PHP?
- Static Frontpage Pagination – Custom loop
- How to have a custom display for both woocommerce archive and product-category pages? [closed]
- Showing user ID on user main page from screen options
- On this day PHP code
- How to loop over custom fields in a page template?
- WordPress theme & site not loading after moving files
- Use Timber/Twig to pull an image by image ID [closed]
- get_usermeta() deprecated in favor of get_user_meta(). But why doesn’t it make use of it?
- Blank space at beginning of tag?
- Link to file in plugin directory from wordpress template?
- Password protecting content in custom template
- Custom Template 404 for specific custom post type
- How to properly insert a link to a template in WordPress?
- Custom field value not saving when it contains a URL?
- Create a new usermeta field for users
- How to get a list of all possible values of a specific user meta key?
- How do I display a user’s previous orders as a select box option on a product?
- Render ninja form inside markup
- How to use an associative array in post__in with WP_Query?
- Mass update excerpt
- How can I get a single php file that is the equivalent of an existing WordPress page?
- function to assign user role based on a field from usermeta
- Custom search results page not working with empty search
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- Creating user status mode in WordPress
- Issues getting PHP to display in category pages
- Adding number to date not working [closed]
- Change title only in dynamic page
- Enable custom logo upload if logo is not in header
- How can I edit the content in index.php? [duplicate]
- Show a different code on front page to other pages
- Can’t print Yoast meta description into page template (syntax error, unexpected ‘.’) [closed]
- a:0:{} is replaced into database as s:6:”a:0:{}”;
- PHP include is only working in certain places in my custom WP theme
- Use WordPress function in php file
- How to get all author posts outside of author templates
- Add filter multiple times using only one master function
- Read array in php?
- php if username is role
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- Removing WordPress Footer -without access to PHP code?
- How to set a template with wp_insert_post
- Why is a wp function used in current PHP namespace’s callback not resolved to global scope?
- How to update and save user metadata on page visits?
- Create page template via functions.php?
- What’s a good way to allow overwriting files within a child theme if I want the same folder structure?
- If Array Values Match Another Array’s Values, Then
- how to display this functions?
- is_page_template showing partial results
- Adding regular php file to site
- Getting different user data depending on where I use variable
- Post repeated when opening in overlay, how do I solve this? [closed]
- Comapare get_user_meta value
- How can get all users by current user meta?
- Creating custom page template from existing PHP site
- php return username of currently viewed author profile
- pass html code to worpdress
- Getting a WordPress tag to print inside of a traditional php echo
- Prevent header and footer from loading on specific pages with template or plugin
- Integrate admin plugin into template. Very interesant (live search + autocomplete with wp rest api, in vanilla js)
- Display metabox galleries on specific page template in admin editor
- Display WordPress archive template page in 3 columns and not 1 column [closed]
- Run do_shortcode on php template using JS function
- User meta needed in query is serialized – how to unserialize safely?
- Include User ID in iFrame URL
- How to hardcode header and footer in WP?
- Polylang and template files
- Store data from JavaScript object to custom table in user account
- Redirect user to a custom url after logged in
- How to change the value of a variable using input field?
- Get user by meta data key and velue
- Where do I implement this display of User Meta Data, and how to put it in a table?
- How to create dynamic templates?
- If is_page elseif is_page not working like I want it to
- Change WooCommerce template for PDF – access to custom field
- Add another role to a user when they click a button?
- missing admin bar and widget in a template
- How to include a function in a template with template tag
- Adding user meta to post meta wp_insert_post() not working
- My own theme’s custom widget areas are not working
- How can get all users by current user meta (array)?
- How do I modify the Previous and Next Page posts on blog pages to include “previous” and “next” before the links?
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Updating custom user meta
- Updating meta_value in a custom key
- Limit the number of successful logins
- How to call a certain object/menubar in a PHP file
- Get author meta of all writers
- Let users register weight each day and save it in DB
- why is markup routinely placed in functions in wordpress?
- A better way to write this php function
- Import users and custom user meta from csv
- Problem with custom user fields default value and retrieval
- How to edit templates created in the block editor in code / template files not updating
- How can I allow a user to add any number of custom user_meta fields on a WordPress front-end page?