-
Notifications
You must be signed in to change notification settings - Fork 4.7k
React to any errors coming up in gutenberg_migrate_menu_to_navigation_post #36461
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -271,6 +271,11 @@ function gutenberg_migrate_menu_to_navigation_post( $new_name, $new_theme, $old_ | |
| 'post_status' => $post_status, | ||
| ); | ||
| $navigation_post_id = wp_insert_post( $post_data ); | ||
| // If wp_insert_post fails *at any time*, then bale out of the entire | ||
| // migration attempt returning the WP_Error object. | ||
| if ( is_wp_error( $navigation_post_id ) ) { | ||
| return $navigation_post_id; | ||
| } | ||
| } | ||
|
|
||
| $area_mapping[ $location_name ] = $navigation_post_id; | ||
|
|
@@ -280,7 +285,7 @@ function gutenberg_migrate_menu_to_navigation_post( $new_name, $new_theme, $old_ | |
| update_option( 'fse_navigation_areas', $area_mapping ); | ||
| } | ||
|
|
||
| add_action( 'switch_theme', 'gutenberg_migrate_menu_to_navigation_post', 200, 3 ); | ||
| add_action( 'switch_theme', 'gutenberg_migrate_menu_to_navigation_post', 99, 3 ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we update the ordering here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because of this change: https://github.com/WordPress/wordpress-develop/pull/1865/files#diff-4112a9a0bb18713bc2fc7868ceffe4403d765722f605e42b313ef2cdc218177fR685 I learned it's more typical to use priority at most 99 in core and that's how it was backported. |
||
|
|
||
| // The functions below are copied over from packages/block-library/src/navigation/index.php | ||
| // Let's figure out a better way of managing these global PHP dependencies. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.