From 5eae30540312034db70b3a706217b2bab8b60c65 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Wed, 16 Sep 2015 19:25:26 +0000 Subject: [PATCH] Throw a notice when an invalid tax is passed to `wp_insert_post()`. Props jdgrimes. Fixes #25477. Built from https://develop.svn.wordpress.org/trunk@34248 git-svn-id: http://core.svn.wordpress.org/trunk@34212 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post-functions.php | 5 +++++ wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/post-functions.php b/wp-includes/post-functions.php index fe0d1cd8ce..c4640d5fe7 100644 --- a/wp-includes/post-functions.php +++ b/wp-includes/post-functions.php @@ -3208,6 +3208,11 @@ function wp_insert_post( $postarr, $wp_error = false ) { if ( ! empty( $postarr['tax_input'] ) ) { foreach ( $postarr['tax_input'] as $taxonomy => $tags ) { $taxonomy_obj = get_taxonomy($taxonomy); + if ( ! $taxonomy_obj ) { + _doing_it_wrong( __FUNCTION__, sprintf( __( 'Invalid taxonomy: %s' ), $taxonomy ), '4.4.0' ); + continue; + } + // array = hierarchical, string = non-hierarchical. if ( is_array( $tags ) ) { $tags = array_filter($tags); diff --git a/wp-includes/version.php b/wp-includes/version.php index 15b4adff53..c3cb548d55 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34247'; +$wp_version = '4.4-alpha-34248'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.