# Overwrite $page object with custom values

**URL:** <https://forum.getkirby.com/t/overwrite-page-object-with-custom-values/6331>\
**Category:** Questions\
**Tags:** v2\
**Created:** [January 18, 2017, 9:57pm UTC](https://forum.getkirby.com/t/overwrite-page-object-with-custom-values/6331 "2017-01-18T21:57:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [January 18, 2017, 9:57pm UTC](https://forum.getkirby.com/t/overwrite-page-object-with-custom-values/6331/1 "2017-01-18T21:57:06Z")

</div>

I tried to create a page object and then replace the values in it with custom ones.

**See the code below:**

```php
$page = page('home');

page::$methods['title'] = function($page) {
  return 'CUSTOM TITLE';
};

$page->title = 'CUSTOM TITLE';

echo $page->title();

```

**It still says:**

> Home

### It works for values that does not exists

```php
$page = page('home');
page::$methods['title1'] = function($page) {
  return 'CUSTOM TITLE1';
};
$page->title1 = 'CUSTOM TITLE2';
echo $page->title1();

```

> CUSTOM TITLE2

In this case it does not help me, as I need to overwrite them, not create new ones.

Is there a way to overwrite `$page` object values?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [January 18, 2017, 10:02pm UTC](https://forum.getkirby.com/t/overwrite-page-object-with-custom-values/6331/2 "2017-01-18T22:02:54Z")

</div>

As stated in the [docs](https://getkirby.com/docs/developer-guide/objects/page#default-page-methods), you cannot override default page methods. You probably can using a page **model** : [https://getkirby.com/docs/developer-guide/advanced/models](https://getkirby.com/docs/developer-guide/advanced/models)

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 4:52pm UTC](https://forum.getkirby.com/t/overwrite-page-object-with-custom-values/6331/3 "2025-02-06T16:52:58Z")

</div>


