Skip to content
Custom fields for WordPress that are quick to build and quick to load. Get Pro

Code and automation

Adding a row to a repeater from code

Read the rows, add yours and write the list back.

1 minute Works with the free plugin

PHP
$post_id = 42;

$rows   = array_map(
	static fn ( $row ) => $row->toArray(),
	ugly_rows( 'team', $post_id )
);
$rows[] = array(
	'name' => 'Marta',
	'role' => 'Waiter',
);

ugly_update( 'team', $rows, $post_id );

Read the rows, convert each one to an array, add yours, and write the whole list back.