Question

I am using both wp_update_user() and update_user_meta() and I want to be able to check for an error, and if one occurs, output it to the user. Is this possible using something like $result = wp_update_user()? I don't want an integer though I want to read the text of the error.

Was it helpful?

Solution

Not really. Deep down such functions are essentially writes to database. So either database write fails (which doesn't produce meaningful message to return) or data is somehow wrong and function just returns false to escape.

Your best bet is probably to control data user inputs, not result of WP trying to process that data.

PS worth mentioning that for debug WP_DEBUG and wpdb error echoing rock, but it's not exactly what you are asking for.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top