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
Answered here. https://github.com/AdvancedCustomFields/acf/issues/269#issuecomment-731647793
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.