Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete the WP_Block_Type::$render_callback property #33

Merged
merged 3 commits into from
May 1, 2023
Merged

Complete the WP_Block_Type::$render_callback property #33

merged 3 commits into from
May 1, 2023

Conversation

lipemat
Copy link
Contributor

@lipemat lipemat commented May 1, 2023

The callback supports 3 parameters

  1. Attributes -> array
  2. Content -> string
  3. Block Object -> \WP_Block

Argument #3 is available under dynamic rendering context as seen here. https://github.com/WordPress/WordPress/blob/e3d1a1291fd3bbfdca3af409e8007d35f2109fa4/wp-includes/class-wp-block.php#L258

In some circumstances (e.g. Legacy widget iframe) argument #3 is not provided. Hence the optional =. https://github.com/WordPress/WordPress/blob/e3d1a1291fd3bbfdca3af409e8007d35f2109fa4/wp-includes/class-wp-block-type.php#L398

lipemat and others added 3 commits May 1, 2023 16:52
@johnbillion
Copy link
Owner

Well spotted, thanks.

@johnbillion johnbillion merged commit 1aa5ff8 into johnbillion:trunk May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants