Hello,
I’m trying to update a field in a webhook process, and its outside WordPress.
I’ve include:
define('WP_USE_THEMES', false);
require('../wp-load.php');
And the WordPress functions are working OK, but when I call
update_field('order_payment_status', 'Paid', $order->ID);
nothing happens.
¿How could I solve that?
Thanks.
There are some reason that this may not be working.
1) This is not an acf field. Is this a field created by ACF? I’m only asking because it looks like a field for some type of eCommerce plugin.
2) Does this field exist and already have a value before you try to update it? update_field() will only work using the field name if the field already exists. If you are updating a post that does not already have this field then you need to use the field key rather than the field name. When using update_field() it is always better to use the field key and forget about using field names.