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

Widget Block: widget_id is undefined when a widget is placed #33152

Merged
merged 2 commits into from Jul 4, 2021

Conversation

@spacedmonkey
Copy link
Member

@spacedmonkey spacedmonkey commented Jul 1, 2021

Some widgets expect for the widget_id $args to be set to render the widget without a PHP notice error. Add back the widget_id and widget_name params to call to the_widget.

See original core code when widget_id and widget_name are populated.

https://github.com/WordPress/wordpress-develop/blob/bdf7dd6299e4453f9d7438de0a0e138d950ec0bf/src/wp-includes/widgets.php#L737-L748

Trac ticket: https://core.trac.wordpress.org/ticket/53548

How has this been tested?

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

Fixes #33056

@spacedmonkey spacedmonkey self-assigned this Jul 1, 2021
@spacedmonkey spacedmonkey added this to PRs needing review in Block-based Widgets Editor via automation Jul 1, 2021
@talldan talldan requested a review from kevin940726 Jul 2, 2021
Copy link
Member

@kevin940726 kevin940726 left a comment

Tested and it fixes the issue. Not sure about the code though since i'm not familiar with PHP but it looks good to me.

@adamziel
Copy link
Contributor

@adamziel adamziel commented Jul 2, 2021

@spacedmonkey PHP linter has some complaints, would you address those please?

@spacedmonkey
Copy link
Member Author

@spacedmonkey spacedmonkey commented Jul 2, 2021

@adamziel Done

@spacedmonkey spacedmonkey requested a review from adamziel Jul 2, 2021
@desrosj
desrosj approved these changes Jul 2, 2021
Copy link
Contributor

@desrosj desrosj left a comment

This seems like a reasonable backwards compatibility change.

If we want to steer developers away from using these, we should add some _doing_it_wrong() notices in core instead of triggering PHP notices.

@desrosj desrosj added this to 🏗️ In progress in WordPress 5.8 Must Haves via automation Jul 2, 2021
@spacedmonkey spacedmonkey merged commit cc70361 into WordPress:trunk Jul 4, 2021
18 checks passed
18 checks passed
@github-actions
test
Details
@github-actions
Compute current and next stable release branches
Details
@github-actions
Checks (12)
Details
@github-actions
Admin - 1 Admin - 1
Details
@github-actions
Run performance tests
Details
@github-actions
test (12.2, gutenberg-editor-initial-html, 14)
Details
@github-actions
JavaScript (12)
Details
@github-actions
Checks (14)
Details
@github-actions
Admin - 2 Admin - 2
Details
@github-actions
JavaScript (14)
Details
@github-actions
Admin - 3 Admin - 3
Details
@github-actions
Admin - 4 Admin - 4
Details
@github-actions
Bump version
Details
@github-actions
Build Release Artifact
Details
@github-actions
Mobile
Details
@github-actions
Create Release Draft and Attach Asset
Details
Block-based Widgets Editor automation moved this from PRs needing review to Done Jul 4, 2021
WordPress 5.8 Must Haves automation moved this from 🏗️ In progress to ✅ Done Jul 4, 2021
@github-actions github-actions bot added this to the Gutenberg 11.1 milestone Jul 4, 2021
youknowriad added a commit that referenced this pull request Jul 5, 2021
youknowriad added a commit that referenced this pull request Jul 6, 2021
youknowriad added a commit that referenced this pull request Jul 7, 2021
vcanales added a commit that referenced this pull request Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Linked issues

Successfully merging this pull request may close these issues.

6 participants