Why aren’t tags and categories added in post request to WP Rest API

You are using name in your terms. In default, try to use the existing term id ( in your case, cat ID and tag ID ). If you see https://plugins.trac.wordpress.org/browser/rest-api/trunk/lib/endpoints/class-wp-rest-posts-controller.php#L918 they will handle your term with sanitize them into non-negative integer using absint. I hope this help. Here example code to hook rest_insert_{$this->post_type} to create … Read more

Develop REST API using WordPress for Android app [closed]

Hopefully someone will extend on my answer…. The critical part of the rest API that is already in core is the registration and routing of endpoints which should look like (taken from http://v2.wp-api.org/extending/adding/) `/** * Grab latest post title by an author! * * @param array $data Options for the function. * @return string|null Post … Read more

Problem with cURL and rest API

The curl_init function accepts an url and what you are passing there looks like a command line call. Please check this link for an example of passing username and password through php curl functionality. Basically you have to use just http://localhost/wp-json/wc/v1/products in curl_init and set username using curl_setopt function with CURLOPT_USERPWD parameter. Example: $ch = … Read more

WP REST API V2 – Add user data to response

Solution A – Prepare User Response You can filter the response for a user to include any property you want with rest_prepare_user. add_filter( ‘rest_prepare_user’, function( $response, $user, $request ) { $response->data[ ‘first_name’ ] = get_user_meta( $user->ID, ‘first_name’, true ); $response->data[ ‘last_name’ ] = get_user_meta( $user->ID, ‘last_name’, true ); return $response; }, 10, 3 ); Solution … Read more

WP Rest endpoint with custom post type and ACF Fields

Advanced custom fields uses get_field() function to retrieve the fields. So, all you have to do is to retrieve them by using: $field = get_field(‘field_name’, $post->ID, ‘format_value’); for each of your fields in the loop. You can read this page for more information. Questions about plugins are off-topic here, That’s why your question haven’t receive … Read more

Adding rest api endpoints to an old theme

WordPress REST API has nothing directly to do with the theme, REST API is in the WordPress core, and any plugin and theme can be made to support it. Normal WordPress themes don’t use REST API: it is relatively new part of the WordPress, and so far, very few themes are made to use REST … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)