Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot transform meta field value when field is already fetched before. #2867

Open
Levdbas opened this issue Dec 19, 2023 · 0 comments

Comments

@Levdbas
Copy link
Member

Levdbas commented Dec 19, 2023

Expected Behavior

     $this->meta('related_project');
      $projects = $this->meta('related_project', [
         'transform_value' => true,
      ]);

// Projects is still now an array instead of id's

Actual behavior

When a field value is already fetched it will not transform anymore.

Steps to reproduce behavior

  1. Create ACF date field & add it to a post
  2. Get post value by
$date = $this->meta('start_date', [
   'transform_value' => true
]);
  1. See that the field is transformed,
  2. Now add $date = $this->meta('start_date) before that line
  3. See that the value does not transform anymore.

Notes

Not sure if we want to fix this, but we must at least document this behaviour if we are not going to change it.

What version of Timber are you using?

2.0.0

What version of WordPress are you using?

6.4.2

What version of PHP are you using?

8.1

How did you install Timber?

Installed or updated Timber through Composer

@Levdbas Levdbas added the bug label Dec 19, 2023
@Levdbas Levdbas changed the title [BUG] Timber\CoreEntity::fetch_meta transform_value gets overwrittenm my filter. [BUG] Timber\CoreEntity::fetch_meta transform_value gets overwritten by filter. Dec 19, 2023
@Levdbas Levdbas changed the title [BUG] Timber\CoreEntity::fetch_meta transform_value gets overwritten by filter. [BUG] Cannot transform meta data when data is already fetched before. Apr 10, 2024
@Levdbas Levdbas changed the title [BUG] Cannot transform meta data when data is already fetched before. [BUG] Cannot transform meta field value when field is already fetched before. Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant