I need to update user meta from php file on my server. Maybe I need some additional permissions?
<?php
require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');
$user_id = 1;
$new_value = 'http://wordpress.org';
// will return false if the previous value is the same as $new_value
update_user_meta( $user_id, 'website', $new_value );
// so check and make sure the stored value matches $new_value
if ( get_user_meta($user_id, 'some_meta_key', true ) != $new_value )
wp_die('An error occurred');
?>
This shows 'An error occured' and user meta is not updated.
website
, but then checking forsome_meta_key
.