How to filter or search the posts using postmeta tables custom meta fields with wordpress REST API

You will need to add custom query vars: add_filter(‘rest_query_vars’, ‘wpse225850_add_rest_query_vars’); function wpse225850_add_rest_query_vars($query_vars) { $query_vars = array_merge( $query_vars, array(‘meta_key’, ‘meta_value’, ‘meta_compare’) ); return $query_vars; } Now, get your posts at example.com/wp-json/wp/v2/posts?filter[meta_key]=property_featured&filter[meta_value]=1. You can follow this ticket for more info.

Create taxonomy with meta term using the WP Rest Api

I think you need an update_callback in register_rest_field(). Please note that I haven’t tested this. add_action( ‘rest_api_init’, ‘slug_register_meta’ ); function slug_register_meta() { register_rest_field( ‘place’, ‘meta’, array( ‘get_callback’ => ‘slug_get_meta’, ‘update_callback’ => ‘slug_update_meta’, ‘schema’ => null, ) ); } function slug_get_meta( $object, $field_name, $request ) { return get_term_meta( $object[ ‘id’ ] ); } function slug_update_meta($value, $object, … Read more

WP API : date_query parameter

As of WP >= 4.7 filter[] is not supported and have been removed. Also WP REST API Plugin became part of WordPress Core. According docs your link should be: https://wptest.enguerranweiss.com/wp-json/wp/v2/posts?orderby=date&order=desc&after=2016-10-13T17:00:00 EDIT As enguerranws mentioned the date should be in ISO8601 format

How to get the attached gallery in the rest API?

To my knowledge this can’t be done out of the box. So you could make use of what get_post_galleries() or get_post_gallery(), the latter is just making use of the former, are doing by adding an endpoint. A minimal example could look like shown below. function rest_get_post_gallery( $data ) { //set FALSE for data output $gallery … Read more

wordpress wp-json prefix issue

You need to set the permalink structure of your website. Goto Settings > Permalink. Remove index.php from the Custom Structure. Click on Save Changes. It re-generate your permalink structure. And you’ll be able to access the posts with http://example.com/index.php/wp-json/wp/v2/posts Updated: .htaccess code like below: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /dev.fresh/ RewriteRule ^index\.php$ … Read more

How to get all posts from parent and children categories?

I had the same use case than you — calling WP-API from React — and ran into the same issue. Unfortunately WP-API does not support filtering by parent categories. In order to support it, you could extend the API’s functionality, adding a new filter that will run a tax_query behind the scenes, similar to Faye’s … Read more

Does the REST API (official) support custom post types?

Thanks for the clarification in the comments. The confusion is between the WordPress.com hosted API and the WordPress.org REST API project, which are different. The WordPress.com API was developed by Automattic and is only available for websites hosted on the WordPress.com platform. There’s some overlap in functionality, but that’s not the documentation you’re looking for … Read more

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