# Adding a row to a repeater from code

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

Source: https://uglydev.com/recipes/adding-a-row-to-a-repeater-from-code/
Updated: 19 November 2026

```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.
