AdvancedCustomFields / AdvancedCustomFields/acf

Unexpected results with $is_preview in block render_callback

Open
#625 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

I apologize if this should be a support request. Let me know if it should be. This felt like possibly a new/change/bug.

When I dump $is_preview in the render_callback function when loading a page with the block already in the editor it fires twice, the first time is true and the second time is false. I've been using this value to conditionally load scripts/styles in the editor for the front vs back end but things have been wonky. Is this something anyone has seen?

I'm using 5.12

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the behavior on version 5.12 with the block already in the editor, logging $is_preview in the render_callback to compare the first and second calls. Done means determining whether the true/false sequence is expected or correcting the behavior and documenting the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.