Your question is not very clear to me but here’s a version of your code which you may try:
<?php
global $current_user;
get_currentuserinfo();
return array(
'author' => array(
'label' => __('Author', 'ait-toolkit'),
'type' => 'select-dynamic',
'dataFunction' => 'AitItemCpt::fillAuthorMetabox',
'default' => $current_user->ID, // or try changing it to $current_user->user_login if it doesn't work
'capabilities' => true,
)
);
Related Posts:
- How to allow an user role to create a new user under a role which lower than his level only?
- How to programatically change username (user_login)?
- How to get userid at wp_logout action hook?
- How to change user_login with wp-cli?
- Replacing the WordPress password validation
- alphabetically order role drop-down selection in dashboard
- WordPress auto login after registration not working
- Change the author slug from nickname to ID
- How to let contributors to create a new revision(draft) editing their published posts
- Retrieve all users from wordpress database via REST/JSON API
- Is there a way to set a user profile to Draft?
- How to order users alphabetically by their last name?
- Wp_User_Query not sorting by meta key
- How to use hyperdb to separate and share a user dataset between wordpress installs?
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- pre_user_query meta_query admin user list
- Any reason to be concerned by a wave of “zombie” blog signups?
- Return ID of authors who have at least one post
- Migrating users from .com to .org?
- How to list users that have written custom post types and hide the ones that have not?
- Front end user meta options for users
- Get total number of authors on the site
- How to migrate wordpress users from one blog to another
- Find out when a user was created and display varied content depending on time since creation
- Drop down list in user profile page
- Creating a Front-end based User Search
- How can I link users across multiple subdomains?
- Create user with author role but no login information
- Importing Existing Users with Passwords
- How to add user meta for all users
- Is there any function available to echo current user’s profile url?
- How can I allow users to sign up but prevent them from accessing the WordPress backend?
- Get User Role by ID not working
- Add user data to table when user is created?
- How to delete all post and attachments of a user when I delete it?
- Why wordpress showe “admin is editing…” whoever edits?
- Restricted registrations or removing the ability to edit your password/email
- Limit amout of sessions on user-by-user basis?
- Redirect user to login before viewing custom post
- Force user to change their password on first log in of site using shortcode
- Remove admin menu links for multiple users by email
- Use wp_update_user to update custom column in wp_users table
- Create a front user register/login/profile & logout without interfering with wp-login.php?
- Display users in order by an “order” custom meta field
- Rest API code to get ID of current user not working: get_current_user_id() gives 0
- C# user_nicename and Display name blank
- How to filter users by last_name?
- WP users page doesn’t show users count by role
- Move users and passwords from one wordpress site to another
- Bulk lock users without email address?
- Failed login attempts
- Custom Query for count_user_posts function
- Does wordpress support natively the concept of logging-in users? (not admins, but users of the website)
- How to pull all the contributer users records and order by Designation (which is users meta data)?
- cannot get user_registered date from get_user_meta
- Delete Users without a First and Last Name
- Display video on homepage for users who have not logged in
- Author comment count in author page
- How to hide user profile fields based on the role of the viewed user?
- user_meta table in staging vs live site
- Customising “user ids” and add to ‘user’ panel in the admin area
- Need to manually add multiple WP users with same e-mail address (with good reason)
- How to get current user on a multi site that is using domain mapping?
- Use members from 1 site on another one
- WordPress Redirect Specific User. Tired of Peter’s redirect Plugin its not working
- User(s) already exists show error please provide a valid username
- Is it possible to make specific posts editable by all authors?
- How do I update user email from frontend input field?
- How to allow access based on the user meta flag
- Authentication between two different sites using the WordPress login cookie
- Block editor completely gone for second of two super user
- How can I display Only the first Array/Object?
- How can i add user display name drop down menu in frontend?
- How to create page for user?
- Return all users that have one or more published blog posts
- members only products
- Modify the user data stdObject and add extra items to it?
- Create relationships between users or user roles
- wp_update_user() returning http 500 internal server error
- update custom field user profile from front end form
- Insert user register into my own user table instead of wp own user
- Change “logged in as a ” link in comments form
- Specific Content on pages based on user
- throttle/limit a logged in user’s http requests to specific page on a per day basis
- I try to add informations to User profile
- force registered user as seller
- Manage user profiles with WordPress
- Not able to call value in the core files
- Limit roles displayed in users.php depending on custom role
- Fetching posts that match a User Profile setting
- Add a column before username in the users profile table
- Will mass deleting WP Users then reimporting CSV with the same userid break WP?
- Privacy in WordPress
- Create a wordpress admin user and only let them edit and post blog posts?
- Shopping plugin with user groups [closed]
- how can i inform other users about new user registration? [closed]
- How to display Most Recently Read 10 Posts by a logged in user in wordpress
- How to create a specific role to manage users
- How to track all users logged into a site?
- Export user data from Squirrly’s Starbox plugin?