#38945 closed defect (bug) (fixed)
Menu customizer : adding a term item to a menu creates a fatal error when previewing the changeset
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Customize | Keywords: | has-patch has-unit-tests commit |
Focuses: | Cc: |
Description
Configuration
- Version of WP : 4.7 RC1-39355
- Browser : Chrome
- PHP Version : 7.0.11
- MySQL Version : 5.5.52
Here's how to reproduce the problem :
- Open the customizer
- Expand the menu section
- Click on an existing menu or create a new one ( it makes no differences )
- Then click on
add item
and pick a term, either a category or a tag - Select a location for this menu if not already done
The javascript console show an error message (see attachment 1 )
Then when refreshing the browser, like if I was coming back to my customized changeset, the following fatal error message is displayed ( see attachment 2 ) :
Catchable fatal error: Object of class WP_Error could not be converted to string in /srv/www/wp-betas/htdocs/wp-includes/formatting.php on line 3767
It seems that a string passed to esc_url()
function at some point (when ?) is actually a WP_Error object.
Attachments (4)
Change History (12)
#1
@
8 years ago
- Keywords has-patch needs-unit-tests added
- Milestone changed from Awaiting Review to 4.7
- Owner set to westonruter
- Status changed from new to accepted
@nikeo great catch! This was introduced in r38991 as part of #38114 in the \WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()
method to ensure nav menu item URL is set according to linked object. There was a typo in how in that it was passing object
instead of object_id
into get_term_link()
. Please give 38945.0.diff a try.
#3
@
8 years ago
- Keywords has-unit-tests added; needs-unit-tests removed
@nikeo please also test 38945.1.diff. I found that the logic for previewing the URL for post type archive links was also failing.
#5
@
8 years ago
@westonruter your latest patch works fine on my side.
I've registered a CPT with a custom tax, everything went fine, before and after the latest patch.
I could create and preview customized changesets with CPT menu items and custom terms items. I couls aslo preview the CPT page and the custom archive page without any problems showing up.
hope it helps !
#6
@
8 years ago
- Keywords commit added
I was able to recreate the issue, and verify that 38945.1.diff fixes it and looks sane (also fixing the same issue with post type archives).
+1 on commit.
attachment_1