mercredi 22 avril 2015

wp.editPost 'API Wordpress' doesn't edit custom fields

When I try to edit custom_fields with wp.editPost. Only edit the other fields, but not custom fields. Custom fields are created again(repeat fields), but will have to be edited.

I am looking: http://ift.tt/1F7eEv9

My array with custom fields is:

    $content = array(
        'post_id' => (int)$idPostWp,
        'title' => $modificarPostWpDecode['title'], //ok edit
        'description' => $modificarPostWpDecode['content'], //ok edit
        'categories' => $modificarPostWpDecode['category'], //ok edit
        'custom_fields' => array(
            array('key' => 'precio', 'value' => $modificarPostWpDecodeCustom['price']), // no edit, fields will be create again
            array('key' => 'category', 'value' => $modificarPostWpDecodeCustom['category']), // no edit, fields will be create again
            array('key' => 'estrenar', 'value' => $modificarPostWpDecodeCustom['new']), // no edit, fields will be create again
            array('key' => 'currency', 'value' => $modificarPostWpDecodeCustom['currency']), // no edit, fields will be create again
            array('key' => 'search', 'value' => $modificarPostWpDecodeCustom['search']) // no edit, fields will be create again
            )
    );

My call to wordpress is:

    $params = array(1, WPUSER, WPPASS, (int)$idPostWp, $modificarPostWpDecode);
    $request = xmlrpc_encode_request('wp.editPost', $params, array('encoding' => 'UTF-8', 'escaping' => 'markup'));

Thank a lot!

Aucun commentaire:

Enregistrer un commentaire