raphaelnikson
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Plugins
In reply to: [JWT Authentication for WP REST API] Wrong password returning htmlWhen I enter a wrong password, the html of the current page route is returned.
You need to pass User and password to return the token
Forum: Developing with WordPress
In reply to: register_rest_field update_callback not workThanks man.. Yes.. look
add_action( 'rest_api_init', function () { register_rest_field( array('servicos', 'posts'), 'servico_status', array( 'get_callback' => 'get_field_servico_status', 'update_callback' => 'slug_update_servicos', 'schema' => array( 'description' => 'My special field', 'type' => 'string', 'context' => array('view', 'edit') ) ) ); }); function get_field_servico_status( $post, $field_name, $request ) { return get_post_meta( $post[ 'id' ], $field_name, true ); } function slug_update_servicos($value, $post, $field_name) { if (!$value || !is_string($value)) { return; } return update_post_meta($post->ID, $field_name, strip_tags($value)); }- This reply was modified 9 years ago by raphaelnikson.
Forum: Fixing WordPress
In reply to: register_rest_field update_callback not workI’m trying to update a custom field, but when I run the route through POSTMAN it does not update the field. Creates a new record. The route is something like:
$POST … wp/v2/posts/362/meta?key=servicos_status&value=pauseSomeone help me?
Viewing 4 replies - 1 through 4 (of 4 total)