From c5f34cb4d088b4256e271f1b95df06416a488e1d Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Wed, 16 Sep 2015 19:24:51 +0000 Subject: [PATCH] Throw a notice when an invalid tax is passed to `wp_insert_post()`. Props jdgrimes. Fixes #25477. git-svn-id: https://develop.svn.wordpress.org/trunk@34248 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post-functions.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wp-includes/post-functions.php b/src/wp-includes/post-functions.php index fe0d1cd8ce..c4640d5fe7 100644 --- a/src/wp-includes/post-functions.php +++ b/src/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);