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:
parent
302e3d1116
commit
c5f34cb4d0
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue