Make WordPress Core


Ignore:
Timestamp:
10/27/2020 04:40:35 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r49326 r49328  
    40924092
    40934093                // Filter out empty terms.
    4094                 if ( isset( $postarr['tax_input'] ) && is_array( $postarr['tax_input'][ $taxonomy ] ) ) {
     4094                if ( isset( $postarr['tax_input'][ $taxonomy ] ) && is_array( $postarr['tax_input'][ $taxonomy ] ) ) {
    40954095                    $postarr['tax_input'][ $taxonomy ] = array_filter( $postarr['tax_input'][ $taxonomy ] );
    40964096                }
Note: See TracChangeset for help on using the changeset viewer.