Is it possible to read a result if wp_update_user or update_user_meta fails?

wordpress.stackexchange https://wordpress.stackexchange.com/questions/10456

  •  16-10-2019
  •  | 
  •  

문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 wordpress.stackexchange
scroll top