# Can't create a table block programatically

**URL:** <https://forum.getkirby.com/t/cant-create-a-table-block-programatically/34038>\
**Category:** Questions\
**Tags:** v4\
**Created:** [May 5, 2025, 9:47am UTC](https://forum.getkirby.com/t/cant-create-a-table-block-programatically/34038 "2025-05-05T09:47:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![arnoson](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/arnoson/32/6155_2.png) [@arnoson](https://forum.getkirby.com/u/arnoson)\
**Post date:** [May 7, 2025, 10:01am UTC](https://forum.getkirby.com/t/cant-create-a-table-block-programatically/34038/2 "2025-05-07T10:01:39Z")

</div>

Okay I found the issue: I have call `toArray()` on the blocks

```php
site()->createChild([
  'slug' => 'blocks-test',
  'template' => 'blocks-test',
  'content' => ['text' => $blocks->toArray()]
])->publish();

```

I found the solution here: [Create custom blocks programmatically - #12 by texnixe](https://forum.getkirby.com/t/create-custom-blocks-programmatically/22137/12). But in this case it was a custom block that didn’t get saved, but `table` is a built-in block.

Would be great if this behavior could be fixed because now it is really inconsistent. Maybe the page update/create methods could call `toArray()` by default if a Blocks instance is passed?

---

_[View the full topic](https://forum.getkirby.com/t/cant-create-a-table-block-programatically/34038)._
