Wordpress Cheat Codes

WordPress cheat code to update User details from frontend

Redirect uppercase to lowercase urls in WordPress

Hello to all, welcome to therichpost.com. In this post, I will tell you, WordPress cheat code to update User details from frontend.

Today again, I am coming with WordPress cheat code to update User details from frontend and this is very easy and useful.

I am sharing these codes because, these codes are very simple but sometime simple thing takes very much time so.

With this post code, I am making frontend form and with that form, I will update login user details. I will hope this will be useful.

Here is the code for wordpress cheat code to update user details from frontend and please use this carefully into your WordPress theme’s template file:

if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {
global $current_user; // Get login user data
$args = array(
    'ID'         => $current_user->id,
    'user_email' => esc_attr( $_POST['user_email'] ),
    'user_nicename' => esc_attr( $_POST['user_nicename'] )
wp_update_user( $args ); // Update user data
<!-- Content -->
<div class="content">
        <div class="row">
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <div class="card">
                    <div class="card-header">
                        <div class="crd-flx">
                            <h2 class="card-title">My Profile</h2>
                    <div class="card-body">
                        <form class="My-profile" id="new_post" name="new_post" method="post" action="">
                            <div class="row">
                                <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                                    <div class="form-group">
                                        <input type='text' class="form-control" name="user_nicename" required value="<?php echo $current_user->user_nicename; ?>" />
                                    <div class="form-group">
                    <!--This is disabled because we can not change the Username-->
                                        <input disabled="disabled" type='text' class="form-control" name="username" value="<?php echo $current_user->user_login; ?>" />
                                    <div class="form-group">
                                        <input type='email' class="form-control" name="user_email" required value="<?php echo $current_user->user_email; ?>" />
                                    <div class="row">
                                        <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
                                            <div class="form-group">
                                                <input type="submit" value="Save" class="btn btn-custom login-btn pull-right"/>

                            <input type="hidden" name="action" value="new_post" />
                            <?php wp_nonce_field( 'new-post' ); ?>
<!-- /.content -->


This is it and if you have any query related to this post then please do comment.


Thank you

Ajay Malhotra
the authorAjay Malhotra
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am full stack developer. I love coding. I know Wordpress, Core php, Angularjs, Angular 2, Angular 6, Angular 7, laravel, Codeigniter, Shopify, Squarespace, Jquery, Google Map Api, Vuejs, Reactjs, Bigcommerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Positive SSL