• Resolved ildaniel8

    (@ildaniel8)


    Hello Everyone
    I’m trying to add a custom field to the response of
    wp-json/wc/v3/products/attributes/3/terms

    i don’t know what $object_type i should assign to register_route_field to get the response I want
    my product taxonomy is: pa_multicolor

    register_rest_field(
            array(  'product_attributes', 'product_attribute_pa_multicolor', 'terms', 'term', 'pa_multicolor', 'product_attribute'  ),     
            'acf_custom',           
            array(
                'get_callback' => 'ground_get_cb',
                'update_callback' => 'ground_update_cb'
            )
        );

    Both the callbacks return a string for now.

    ‘acf_custom’ doesn’t appear in the JSON of the reponse

    I’ve googled and searched the forum but couln’t find an answer

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding custom field to REST taxonomy’ is closed to new replies.