Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- code: "json_no_route",
- message: "No route was found matching the URL and request method"
- }
- ]
- function get_post_details ($params)
- {
- $id = $_GET['id'];
- $meta_value = $_GET['meta_value'];
- if(update_post_meta( $id, '_yoast_wpseo_redirect', $meta_value ))
- {
- $post['status'] = 'Successfully Updated';
- $post['flag'] = '1';
- }
- else
- {
- $post['status'] = 'Error';
- $post['flag'] = '0';
- }
- if( empty( $post ) ){
- return null;
- }
- return $post;
- }
- // Register the rest route here.
- add_action( 'rest_api_init', function () {
- register_rest_route( 'post_info', 'post',array(
- 'methods' => 'GET',
- 'callback' => 'get_post_details'
- ));
- });
Add Comment
Please, Sign In to add comment