WordPress - How to insert custom_fields when inserting the publication via API v2?

0

I'm adding posts to my WordPress site through the v2 API. The post is being inserted, but the custom_fields are not. Here is my payload below:

$data = [
    'title'         => 'Meu novo titulo 03',
    'status'        => 'publish',
    'meta_data'     => [
        [
            'key' => 'bt_thumb',
            'value' => '111'
        ],
        [
            'key' => 'embed_code',
            'value' => '222'
        ],
    ]
];

It does not error, simply does not insert custom_fields (custom_fields already exist in WP, see image below).

Thanks!

    
asked by anonymous 06.09.2018 / 14:54

1 answer

0

So, my call was for a solution that does not need to use plugin, however, at the moment I found this solution which I am using. Thank you all and hope you can help people with this problem in the future. Resolution: link

    
07.09.2018 / 07:24