Hi there,
In my current project, I create a new post via the public front end (contact form) and I would like to add to the newly created post reference to existing posts (foreign key).
For that I am using a Post Object in a Repeater Field (we need to be able to manage these foreign keys from the WordPress admin panel). But I can’t get it to work. What kind of object am I supposed to pass to the add_row function ? Neither a WP_Post object nor a post ID seems to work. But the code works if I am using a simple text field.
Any recommendation ?
foreach ($_POST["会社"] as $company) {
//echo get_page_by_title( $company, OBJECT, "company" )->id;
$i = add_row(
get_field_object("introduction", $post_id)['key'],
array(
"intro_cie" => get_page_by_title( $company, OBJECT, "company" )
),
$post_id
);
echo "Go: ";
var_dump($i);
}