I have a user page in my Wordpress installation, which, among other things, allows the user to display and change their email address from the external interface.
However, when they do this, the letter changes correctly in the database, but does not update on the page until another update (with or without $_POST ). This behavior is really strange, and I can not find the reason.
Here is the problematic part of the code:
if ( !empty( $_POST['user_email'] ) ) wp_update_user( array ('ID' => $queried_user->id, 'user_email' => esc_attr( $_POST['user_email'] ) ) ) ;
If I execute var_dump($_POST) and var_dump($queried_user) , I get that user_email correctly displayed in the variable $_POST , but, accordingly, remains the same in the variable $queried_user . However, looking at the database through PHPMyAdmin, I see that the data has already been updated. After the next update of the browser page, everything is displayed correctly.
Any pointers?
source share