mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Posts, Post Types: Check if taxonomy is set for the tax_input parameter of wp_insert_post().
This avoids a PHP notice when creating a post with multiple taxonomies both having a default term. Props yakimun, szaqal21, hareesh-pillai, audrasjb. Fixes #51320. git-svn-id: https://develop.svn.wordpress.org/trunk@49328 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -4091,7 +4091,7 @@ function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true )
|
||||
if ( ! empty( $tax_object->default_term ) ) {
|
||||
|
||||
// Filter out empty terms.
|
||||
if ( isset( $postarr['tax_input'] ) && is_array( $postarr['tax_input'][ $taxonomy ] ) ) {
|
||||
if ( isset( $postarr['tax_input'][ $taxonomy ] ) && is_array( $postarr['tax_input'][ $taxonomy ] ) ) {
|
||||
$postarr['tax_input'][ $taxonomy ] = array_filter( $postarr['tax_input'][ $taxonomy ] );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user