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:
- To close or not to close php
- 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?
- Displaying a WooCommerce product via PHP
- What exactly does “Posts page” do in WordPress?
- Check if a menu is empty?
- Static Frontpage Pagination – Custom loop
- Get the php template file from other theme folder
- WordPress Template Engine?
- How to have a custom display for both woocommerce archive and product-category pages? [closed]
- wp_remote_get returns an error for valid URL
- Calling a method from functions.php on a click of a button
- 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?
- Blank on static home page?
- WordPress theme & site not loading after moving files
- Adjust the results quantity for Search Results page pagination
- Exclude pages with certain template from wp_list_pages
- Use Timber/Twig to pull an image by image ID [closed]
- Categories Template Assistance
- Is it possible to use the featured image of a page as a css background without inlining?
- Unable to set right time in admin and frontend template
- Easiest way to show total number of subpages
- Switching between custom templates in a post type of the admin menu
- Use template for posts with a particular category grandparent
- Issue with foreach on duplicate meta_key’s
- get_usermeta() deprecated in favor of get_user_meta(). But why doesn’t it make use of it?
- Blank space at beginning of tag?
- Placing the_content inside shortcode not working
- Link to file in plugin directory from wordpress template?
- Password protecting content in custom template
- How to override wp-admin styling
- Add a Second Menu to a theme that only support 1 menu
- Custom excerpt function re-factoring
- Inject PHP code into “sidebar-content” – code before my WooCommerce sidebar widget?
- Custom Template 404 for specific custom post type
- An unwanted inline style is added to my body tag
- How to properly insert a link to a template in WordPress?
- Custom field value not saving when it contains a URL?
- Get all user meta by meta key instead of ID
- Create a new usermeta field for users
- Automatically add custom CSS to new posts using a category template
- 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 can I load a PHP page without using a Template?
- how could I load a different template part by page
- missing admin bar and widget in a template
- not able to access $_POST on backend profile update
- How to include a function in a template with template tag
- Right way to display the_author_meta fields?
- What syntax is this? “{{post.price}}”
- Adding user meta to post meta wp_insert_post() not working
- Get meta_query value by user meta array
- Creating a custom register form
- get_users when from meta key that has serialized values
- 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?
- Store stripe info as user_meta
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Updating custom user meta
- Add point on excerpt post
- Updating meta_value in a custom key
- WooCommerce – Print Processing orders [closed]
- Loop returns more items than exist?
- Access methods in plugin template
- Create dynamic content from one WP page to multiple other pages
- Limit the number of successful logins
- How to call a certain object/menubar in a PHP file
- Problems With Query and/or Template Part and/or PHP
- Get author meta of all writers
- Let users register weight each day and save it in DB
- why is this content-template not showing any of my blog-entries?
- how to register a second page-template
- why is markup routinely placed in functions in wordpress?
- PHP code rendered in HTML
- Odd page behaviour after removing sidebar
- get_permalink returning first letter
- Hide a nav menu item based on get_user_meta results
- Custom Archive Page
- If I define a variable in header.php, how do I make it available to templates?
- How to refresh a template page on WordPress in 3 seconds – easiest method?
- php “use” not working in template [closed]
- Loop on a wordpress Page instead of content coming from the WP text editor
- Twig+WordPress how to use array arguments inside a function?
- How to implement a custom sliding banner? [closed]
- A better way to write this php function
- Import users and custom user meta from csv
- How can one use variables in a template or template part without polluting the global scope?
- Need Help With Making Full-Width Template for Blog Posts (common methods aren’t working)
- Problem with custom user fields default value and retrieval
- How to edit templates created in the block editor in code / template files not updating
- WordPress post-template null warnings
- How can I allow a user to add any number of custom user_meta fields on a WordPress front-end page?
- AJAX Appending Data Adds Mystery “0” :(