Support

Account

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 👍.