# 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:** 12

<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, 2:11am UTC](https://meta.discourse.org/t/custom-excerpt-length-not-working-for-me/284100/12 "2023-11-03T02:11:54Z")

</div>

Thanks, appreciated the feedback.

We’ve signed up for the trial as you suggested and were able to reproduce the issue.

We found out that even renaming `$post` to `$local_post` or similar doesn’t solve the issue. The only workaround we found is to `json_encode` and then `json_decode` the content, as to create a completely separate object. Very ugly.

Nevertheless, we published an update to solve this incompatibility, even if the previous design was 100% correct from a code standpoint.

Here’s the patch that has already been published

```plaintext
- unset($post->post_content);
+ $json = json_encode($post);
+ $local_post = json_decode($json);
+ unset($local_post->post_content);
        if ($post->post_status === 'publish') {
                if (!get_option('lnkbio_id') || !get_option('lnkbio_secret')) {
                        return;
@@ -138,7 +140,7 @@ function lnkbio_api_sync($post_id, $post, $update) {
                                'body' => [
                                        'ACTION' => 'WP_sync',
                                        'post_id' => $post_id,
- 'post' => json_encode($post),
+ 'post' => json_encode($local_post),
                                        'id' => get_option('lnkbio_id'),
                                        'secret' => get_option('lnkbio_secret'),
                                        'permalink' => get_permalink($post),

```

---

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