# Custom Excerpt Length not working for me

**URL:** <https://meta.discourse.org/t/custom-excerpt-length-not-working-for-me/284100>\
**Category:** WordPress\
**Created:** [November 1, 2023, 10:57am UTC](https://meta.discourse.org/t/custom-excerpt-length-not-working-for-me/284100 "2023-11-01T10:57:39Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![lnkbio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lnkbio/32/337531_2.png) [@lnkbio](https://meta.discourse.org/u/lnkbio)\
**Post date:** [November 3, 2023, 3:15am UTC](https://meta.discourse.org/t/custom-excerpt-length-not-working-for-me/284100/14 "2023-11-03T03:15:18Z")

</div>

You didn’t come harsh at all, you had great insights.

After working on it a bit more, we found a better, more elegant solution using the `clone` function.

This has already been published to the updated Lnk.Bio plugin and the patch is simply

```plaintext
diff --git a/lnk.bio.php b/lnk.bio.php
index 65759fc..cc0c0d2 100644
--- a/lnk.bio.php
+++ b/lnk.bio.php
@@ -126,8 +126,7 @@ function lnkbio_api_post(string $url, array $data) {
 }

 function lnkbio_api_sync($post_id, $post, $update) {
- $json = json_encode($post);
- $local_post = json_decode($json);
+ $local_post = clone($post);
        unset($local_post->post_content);
        if ($post->post_status === 'publish') {
                if (!get_option('lnkbio_id') || !get_option('lnkbio_secret')) {

```

---

_[View the full topic](https://meta.discourse.org/t/custom-excerpt-length-not-working-for-me/284100)._
