Coding Standards: Reformat a condifion for default taxonomy terms in map_meta_cap() for better readability.

Follow-up to [48356], [48480].

See #43517.

git-svn-id: https://develop.svn.wordpress.org/trunk@48664 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-07-28 14:40:06 +00:00
parent 6e66f08ec9
commit 2547c15fee
3 changed files with 6 additions and 3 deletions

View File

@ -539,7 +539,10 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
break; break;
} }
if ( 'delete_term' === $cap && ( get_option( 'default_' . $term->taxonomy ) == $term->term_id || get_option( 'default_taxonomy_' . $term->taxonomy ) == $term->term_id ) ) { if ( 'delete_term' === $cap
&& ( get_option( 'default_' . $term->taxonomy ) == $term->term_id
|| get_option( 'default_taxonomy_' . $term->taxonomy ) == $term->term_id )
) {
$caps[] = 'do_not_allow'; $caps[] = 'do_not_allow';
break; break;
} }

View File

@ -4054,7 +4054,7 @@ function wp_insert_post( $postarr, $wp_error = false ) {
$postarr['tax_input'][ $taxonomy ] = array_filter( $postarr['tax_input'][ $taxonomy ] ); $postarr['tax_input'][ $taxonomy ] = array_filter( $postarr['tax_input'][ $taxonomy ] );
} }
// Passed custom taxonomy list overwrites existing list if not empty. // Passed custom taxonomy list overwrites the existing list if not empty.
$terms = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) ); $terms = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) );
if ( ! empty( $terms ) && empty( $postarr['tax_input'][ $taxonomy ] ) ) { if ( ! empty( $terms ) && empty( $postarr['tax_input'][ $taxonomy ] ) ) {
$postarr['tax_input'][ $taxonomy ] = $terms; $postarr['tax_input'][ $taxonomy ] = $terms;

View File

@ -455,7 +455,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
) )
); );
// Update term id in options. // Update `term_id` in options.
if ( ! is_wp_error( $term ) ) { if ( ! is_wp_error( $term ) ) {
update_option( 'default_taxonomy_' . $taxonomy_object->name, $term['term_id'] ); update_option( 'default_taxonomy_' . $taxonomy_object->name, $term['term_id'] );
} }