Exclude posts w/ specific post_meta on Rest API endpoint

Caveat From the REST API docs: Changing or removing data from core REST API endpoint responses can break plugins or WordPress core behavior, and should be avoided wherever possible. That said, there’s a rest_post_query filter (well, rest_{$this->post_type}_query) that will let you modify the WP_Query that’s grabbing your posts, so you should be able to add … Read more

Rest API Custom Endpoint with space character

You can do this like this: function get_custom_search_callback($request) { //$parameters = $request->get_params(); $response = urldecode($request->get_param(‘search’)); return rest_ensure_response($response); } add_action(‘rest_api_init’, ‘add_custom_users_api’); function add_custom_users_api(){ register_rest_route(‘namespace/v1’, ‘custom-search/(?P<search>([a-zA-Z]|%20)+)’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘get_custom_search_callback’ ) ); } Note two things: you have to add %20 to the matched character set you have to urldecode() the search variable value … Read more

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