Home › Forums › General Issues › PHP Notice when seeing post object after programmatically assiging it › Reply To: PHP Notice when seeing post object after programmatically assiging it
I think you are trying to pass an array in the update field function and you haven’t defined a field. I think you need to pass a number to the post object. You may want to add another variable to get the page ID.
Whatever $nombre_cargo is, you need to use the field name or field key as the first parameter of the update field function. For example: ‘nombre_cargo’ or ‘field_123456890’
Try this, but replace the name of the field first.
$per_obj = get_page_by_title( $resp, OBJECT, 'persona' );
if (!is_null($per_obj)) {
$page = per_obj->ID;
}
update_field( 'cargo_number', $page, $post_id );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.