From 46778fe2b022ebd3d30027db83791c3a2de2cc22 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 4 Nov 2015 07:28:36 +0000 Subject: [PATCH] Customize: Simplify condition for returning `nav_menus_invalid_post_type` error. Props swissspidy. See #16075. git-svn-id: https://develop.svn.wordpress.org/trunk@35501 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-customize-nav-menus.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/class-wp-customize-nav-menus.php b/src/wp-includes/class-wp-customize-nav-menus.php index 6f5944f59c..ddc01fd89c 100644 --- a/src/wp-includes/class-wp-customize-nav-menus.php +++ b/src/wp-includes/class-wp-customize-nav-menus.php @@ -107,10 +107,9 @@ final class WP_Customize_Nav_Menus { $items = array(); if ( 'post_type' === $type ) { - if ( ! get_post_type_object( $object ) ) { + $post_type = get_post_type_object( $object ); + if ( ! $post_type ) { return new WP_Error( 'nav_menus_invalid_post_type' ); - } else { - $post_type = get_post_type_object( $object ); } if ( 0 === $page && 'page' === $object ) {