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] Timber::get_post() returns stdObject instead of ?Post #2984

Closed
RomanZhakhovTR opened this issue May 2, 2024 · 1 comment
Closed

[BUG] Timber::get_post() returns stdObject instead of ?Post #2984

RomanZhakhovTR opened this issue May 2, 2024 · 1 comment
Labels
needs-info Need more info on this issue in order to properly investigate

Comments

@RomanZhakhovTR
Copy link

RomanZhakhovTR commented May 2, 2024

Expected Behavior

Function call must return the null|Post data type according to the documentation

Actual behavior

In some cases I get an object of type \stdClass

object(stdClass)#4985 (2) { ["ID"]=> int(24685) ["post_parent"]=> int(0) }

Notes

I encountered a strange behavior with the Timber::get_post() function when attempting to call it from the admin panel. On some pages, I receive a \stdClass instead of the expected Post. Is this behavior expected, or is it still a bug?

What version of Timber are you using?

Timber 2.1

What version of WordPress are you using?

Wordpress 65

What version of PHP are you using?

PHP 8.2

How did you install Timber?

Installed or updated Timber through Composer

@RomanZhakhovTR RomanZhakhovTR changed the title [BUG] Timber::get_post() returns stdObject inseted of ?Post [BUG] Timber::get_post() returns stdObject instead of ?Post May 2, 2024
@Levdbas
Copy link
Member

Levdbas commented May 7, 2024

Hi @RomanZhakhovTR ,

Can you provide an example on how you make those calls from the backend? Is it in a editor page or another page? Please post examples if working with such edge-cases so we can be of help.

@Levdbas Levdbas added the needs-info Need more info on this issue in order to properly investigate label May 7, 2024
@Levdbas Levdbas closed this as completed May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-info Need more info on this issue in order to properly investigate
Projects
None yet
Development

No branches or pull requests

2 participants