6 | | It's worth noting, however, that for the `is_wp_error()` condition to work, `wp_update_post()` should be called with the `$wp_error` parameter set to `true`, as it's `false` by default. The same applies to the check linked above: I think the `is_wp_error( $menu_item_db_id )` part doesn't work as expected, as `wp_insert_post()` never returns a `WP_Error` object unless the `$wp_error` parameter is `true`. |
| 6 | It's worth noting, however, that for the `is_wp_error()` condition to work, `wp_update_post()` should be called with the `$wp_error` parameter set to `true`, as it's `false` by default. The same applies to the check linked above: I think the `is_wp_error( $menu_item_db_id )` part in [source:tags/5.8.1/src/wp-includes/nav-menu.php?marks=530-532#L525 line 530] doesn't work as expected, as `wp_insert_post()` never returns a `WP_Error` object unless the `$wp_error` parameter is `true`. |