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
This commit is contained in:
Boone Gorges 2015-09-16 19:25:26 +00:00
parent 471fc6d9a5
commit 5eae305403
2 changed files with 6 additions and 1 deletions

View File

@ -3208,6 +3208,11 @@ function wp_insert_post( $postarr, $wp_error = false ) {
if ( ! empty( $postarr['tax_input'] ) ) { if ( ! empty( $postarr['tax_input'] ) ) {
foreach ( $postarr['tax_input'] as $taxonomy => $tags ) { foreach ( $postarr['tax_input'] as $taxonomy => $tags ) {
$taxonomy_obj = get_taxonomy($taxonomy); $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. // array = hierarchical, string = non-hierarchical.
if ( is_array( $tags ) ) { if ( is_array( $tags ) ) {
$tags = array_filter($tags); $tags = array_filter($tags);

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.