change user password REST API

This question is from 9 months ago and maybe it is solved right now. but I’ll send the answer to help other people who may have this question: You have to install JWT plugin. Then, you have to create Bearer Token by POSTing a username and password to this address: https://example.com/wp-json/jwt-auth/v1/token In postman, you have … Read more

current_user_can() causing critical error

The problem is that wp_get_current_user (which current_user_can relies upon) is pluggable, which means it isn’t loaded until after plugins are loaded (to give plugins a chance to override it). That means it’s not available to call from the top level of a plugin file. Instead, I’d make the role check inside the hook e.g. function … Read more

Perform multiple actions after wp_insert_user()

Note that wp_set_auth_cookie() will set cookies (using setcookie()) which means there must be no output (HTML, spaces, empty lines, etc.) sent to the browser yet, or otherwise, the cookies will not be set or updated. And I said that because by the time you call wp_insert_user(), there has actually been an output sent to the … Read more