From 5d50b55c7e9fccfec512e14bfe1e888b7d0b92a9 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 26 Mar 2015 01:22:01 +0000 Subject: [PATCH] When saving post, ensure that non-hierarchical taxonomy input is defined before attempting to parse it. Taxonomy metaboxes that are disabled for the current user are included in the post.php markup, but do not contain the 'newtag' field, and so should be skipped when looping through the metaboxes to avoid invoking String methods on a variable of type `undefined`. Props MikeNGarrett, A5hleyRich. Fixes #30859. git-svn-id: https://develop.svn.wordpress.org/trunk@31895 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/tags-box.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wp-admin/js/tags-box.js b/src/wp-admin/js/tags-box.js index c610aaab8c..9535255738 100644 --- a/src/wp-admin/js/tags-box.js +++ b/src/wp-admin/js/tags-box.js @@ -112,6 +112,11 @@ var tagBox, array_unique_noempty; a = a || false; text = a ? $(a).text() : newtag.val(); + + if ( 'undefined' == typeof( text ) ) { + return false; + } + tagsval = tags.val(); newtags = tagsval ? tagsval + comma + text : text;