[wp-trac] [WordPress Trac] #53140: State clearly that has_block() doesn't work in reusable blocks

WordPress Trac noreply at wordpress.org
Mon May 3 18:35:56 UTC 2021


#53140: State clearly that has_block() doesn't work in reusable blocks
--------------------------+-----------------------------
 Reporter:  vyskoczilova  |      Owner:  (none)
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:
 Severity:  normal        |   Keywords:
  Focuses:  docs          |
--------------------------+-----------------------------
 The has_block() function doesn't work in reusable blocks. Since the
 content of reusable blocks is not parsed yet (see my [blog
 post](https://kybernaut.cz/en/clanky/check-for-has_block-inside-reusable-
 blocks/) for more details).

 That's fine, but I think that should be stated more clearly than the
 original
 [description](https://developer.wordpress.org/reference/functions/has_block/#description):
 ''This test optimizes for performance rather than strict accuracy,
 detecting the block type exists but not validating its structure. For
 strict accuracy, you should use the block parser on post content.''

 I would suggest changing that to the following, so it's clear what it's
 mostly impacted with the "performance accuracy."

 ''This test optimizes for performance rather than strict accuracy,
 detecting the block type exists but not validating its structure **(e.g.,
 doesn't check reusable blocks)**. For strict accuracy, you should use the
 block parser on post content.''

 What do you think?

 I'm happy to submit it as a patch since it looks like a good "first
 issue," but never done it before.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53140>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list