Change user URL

Go to Settings > Permalinks and set it up as follows Custom Structure and put . in category base

add a Custom Columns to user

You can use the bellow function for adding custom column to users table: function modify_user_columns($column_headers) { $column_headers[‘custom_field’] = ‘Custom field’; return $column_headers; } add_action(‘manage_users_columns’, ‘modify_user_columns’); function custom_admin_css() { echo ‘<style> .column-custom_field {width: 8%} </style>’; } add_action(‘admin_head’, ‘custom_admin_css’); function user_posts_count_column_content($value, $column_name, $user_id) { if ( ‘custom_field’ == $column_name ) { return ‘Value’; } return $value; } … Read more

Changing the admin User Profile page

You can style the user profile page with CSS by using admin_enqueue_scripts(). Actually rearranging the ordering or structure of the content might require hooking into or overriding Advanced Custom Fields in some way, though.

Registration page as homepage

You can create a shortcode for displaying a registration form and add it to a page or create a custom template with registration page layout. Once the page will be there, you can choose that page to display in home page from Setting >> Reading >> Front Page Display ( as in image ) From … Read more

Grab user_id inside a function

Your function requires an input argument $user in order to work. If you simply call wp_user_id() without any argument it will return an error. The solution is giving $user a default value, making the argument optional. function wp_user_id( $user = NULL ) { // Give $user a default value of NULL if ( empty($user) ) … Read more

How to restrict Admin from creating new users from Add new user screen in dashboard to only of one domain?

You can hook into registration_error and check if the user’s email is under your specified domain or not: add_filter( ‘registration_errors’, ‘user_email_checker’, 10, 3 ); function user_email_checker( $errors, $sanitized_user_login, $user_email ) { if ( !preg_match(‘#[@.]gmail.com$#i’, $user_email ) { $errors->add( ‘invalid_email’, __( ‘ERROR: Only “gmail.com” email address allowed.’ ) ); } return $errors; } This way you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)