No user found when using REST API

This is happening because you are not using nonces. Because you have not provided a nonce with the request, WordPress is treating you as if you are an unauthorized/non-logged in user. This is because wordpress has no way of knowing/validating the users state. To get this working, you will have to generate a nonce like … Read more

Shortcode to update user meta

Basically, you can’t show the button and update the meta at the same moment. This has to be done in two separate requests as follows: Show the button whereever you want. It needs to be a form that submits to the same page (or an ajax call to another URL, but let’s keep it simple … Read more