mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 19:46:21 +00:00
Customize: Fix logic for previewing the URL for nav_menu_item
settings for terms and post type archives.
Fixes typo in args passed to `get_term_link()` which caused a fatal error due to this call returning a `WP_Error` which was set to `url`. Also fixes never-satisfiable condition for obtaining post type archive URL. Also ensures that `WP_Error` never leaks through as `url` by setting it to an empty string. Adds missing unit tests. Amends [38991]. See #38114. Fixes #38945. Built from https://develop.svn.wordpress.org/trunk@39365 git-svn-id: http://core.svn.wordpress.org/trunk@39305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9011477638
commit
b9b0371470
@ -604,14 +604,15 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
|
||||
}
|
||||
|
||||
// Ensure nav menu item URL is set according to linked object.
|
||||
if ( ! empty( $post->object_id ) ) {
|
||||
if ( 'post_type' === $post->type ) {
|
||||
$post->url = get_permalink( $post->object_id );
|
||||
} elseif ( 'post_type_archive' === $post->type && ! empty( $post->object ) ) {
|
||||
$post->url = get_post_type_archive_link( $post->object );
|
||||
} elseif ( 'taxonomy' == $post->type && ! empty( $post->object ) ) {
|
||||
$post->url = get_term_link( (int) $post->object, $post->object );
|
||||
}
|
||||
if ( 'post_type' === $post->type && ! empty( $post->object_id ) ) {
|
||||
$post->url = get_permalink( $post->object_id );
|
||||
} elseif ( 'taxonomy' === $post->type && ! empty( $post->object ) && ! empty( $post->object_id ) ) {
|
||||
$post->url = get_term_link( (int) $post->object_id, $post->object );
|
||||
} elseif ( 'post_type_archive' === $post->type && ! empty( $post->object ) ) {
|
||||
$post->url = get_post_type_archive_link( $post->object );
|
||||
}
|
||||
if ( is_wp_error( $post->url ) ) {
|
||||
$post->url = '';
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-includes/nav-menu.php */
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.8-alpha-39364';
|
||||
$wp_version = '4.8-alpha-39365';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
x
Reference in New Issue
Block a user