Unable to create a Rest end-point

As of WordPress 5.5, register_rest_route()‘s permission_callback argument is required. You should be receiving/logging an error message to the effect of PHP Notice: register_rest_route was called incorrectly. The REST API route definition for /search-cert is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. … Read more

WP rest api endpoint protection using jwt token

Once user hit the api endpoint will check the token valid or not and process the function send information to wordpress api end point with success details. function update_payment_history(WP_REST_Request $request) { if(!$request->get_header(‘authorization’)){ return new WP_Error( ‘jwt_auth_no_auth_header’, ‘Authorization header not found.’, array( ‘status’ => 403, ) ); exit; } else if($request->get_header(‘authorization’)){ $response = wp_remote_post( ‘https://example.com/wp-json/jwt- auth/v1/token/validate’, … Read more

Replace content via rest api only?

You can use filter for replace text in all post and all pages. add this code to theme function.php add_filter( ‘the_content’, ‘filter_content_for_replace_text’ ); function filter_content_for_replace_text($content){ $content=str_replace(“find”,”replace with”,$content); return $content; }

How to add an endpoint to WP

You need to return a WP_REST_Response object instead of an array. See https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/ and https://developer.wordpress.org/reference/classes/wp_rest_response/.

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