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
This commit is contained in:
Boone Gorges 2015-09-16 19:24:51 +00:00
parent 302e3d1116
commit c5f34cb4d0
1 changed files with 5 additions and 0 deletions

View File

@ -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);