Need to get user data via API

So wp-json/wp/v2/users/<#id> is only going to give you back basic data on that user, which is what I don’t think you are looking for. Where are you storing and editing consumer_key and consumer_secret? The WordPress Rest API only makes certain pieces of data available out of the box. Sounds like you’d have to extend your … Read more

Rest API: Register and Login errors aren’t specific

The problem I was having is that I wasn’t receiving the full error object. To do that I changed the code to: const { username, password, email } = this.state; axios .post(`${Config.apiUrl}/wp/v2/users/register`, { username: username, password: password, email: email, }) .catch(err => { console.log({err}) }); Which then allowed me to figure out that the error … Read more

rest api add post meta

You’ll want to use the field and the post type. You’ll add the following to your functions.php add_action( ‘rest_api_init’, function () { register_rest_field( ‘<post-type>’, ‘folder_path’, array( ‘get_callback’ => function( $post_arr ) { return get_post_meta( $post_arr[‘id’], ‘folder_path’, true ); }, ) ); register_rest_field( ‘<post-type>’, ‘file_name’, array( ‘get_callback’ => function( $post_arr ) { return get_post_meta( $post_arr[‘id’], ‘file_name’, … Read more