Home › Forums › Backend Issues (wp-admin) › Some PHP function calls aren't shown in the backend preview › Reply To: Some PHP function calls aren't shown in the backend preview
Please keep in mind that some WP functions such as get_the_title() and get_the_post_thumbnail_url() refer to a global $post object if the $post_id variable is not provided (or in your case set to null). During the AJAX request to render the block preview, that global $post object is not setup, which explains why those functions are not running as intended.
The soution is simple, either setup the gobal $post object manually, or use the provided $post_id parameter in any get_the_title() or get_the_post_thumbnail_url() calls 👍.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.