Make WordPress Core

Ticket #16502: 16502.2.diff

File 16502.2.diff, 3.9 KB (added by SergeyBiryukov, 2 years ago)
  • src/wp-admin/includes/class-wp-posts-list-table.php

     
    11671167                        }
    11681168                }
    11691169
    1170                 get_inline_data( $post );
     1170                /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
     1171                $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_post_type', true, $post->post_type );
     1172
     1173                if ( $quick_edit_enabled ) {
     1174                        get_inline_data( $post );
     1175                }
    11711176        }
    11721177
    11731178        /**
     
    14731478                                __( 'Edit' )
    14741479                        );
    14751480
    1476                         if ( 'wp_block' !== $post->post_type ) {
     1481                        /**
     1482                         * Filters whether Quick Edit should be enabled for the given post type.
     1483                         *
     1484                         * @since 6.4.0
     1485                         *
     1486                         * @param bool   $enable    Whether to enable the Quick Edit functionality. Default true.
     1487                         * @param string $post_type Post type name.
     1488                         */
     1489                        $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_post_type', true, $post->post_type );
     1490
     1491                        if ( $quick_edit_enabled && 'wp_block' !== $post->post_type ) {
    14771492                                $actions['inline hide-if-no-js'] = sprintf(
    14781493                                        '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
    14791494                                        /* translators: %s: Post title. */
  • src/wp-admin/includes/class-wp-terms-list-table.php

     
    426426                        $name
    427427                );
    428428
    429                 $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
    430                 $output .= '<div class="name">' . $qe_data->name . '</div>';
     429                /** This filter is documented in wp-admin/includes/class-wp-terms-list-table.php */
     430                $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_taxonomy', true, $taxonomy );
    431431
    432                 /** This filter is documented in wp-admin/edit-tag-form.php */
    433                 $output .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
    434                 $output .= '<div class="parent">' . $qe_data->parent . '</div></div>';
     432                if ( $quick_edit_enabled ) {
     433                        $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
     434                        $output .= '<div class="name">' . $qe_data->name . '</div>';
    435435
     436                        /** This filter is documented in wp-admin/edit-tag-form.php */
     437                        $output .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
     438                        $output .= '<div class="parent">' . $qe_data->parent . '</div></div>';
     439                }
     440
    436441                return $output;
    437442        }
    438443
     
    485490                                esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $tag->name ) ),
    486491                                __( 'Edit' )
    487492                        );
    488                         $actions['inline hide-if-no-js'] = sprintf(
    489                                 '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
    490                                 /* translators: %s: Taxonomy term name. */
    491                                 esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $tag->name ) ),
    492                                 __( 'Quick&nbsp;Edit' )
    493                         );
     493
     494                        /**
     495                         * Filters whether Quick Edit should be enabled for the given taxonomy.
     496                         *
     497                         * @since 6.4.0
     498                         *
     499                         * @param bool   $enable   Whether to enable the Quick Edit functionality. Default true.
     500                         * @param string $taxonomy Taxonomy name.
     501                         */
     502                        $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_taxonomy', true, $taxonomy );
     503
     504                        if ( $quick_edit_enabled ) {
     505                                $actions['inline hide-if-no-js'] = sprintf(
     506                                        '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
     507                                        /* translators: %s: Taxonomy term name. */
     508                                        esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $tag->name ) ),
     509                                        __( 'Quick&nbsp;Edit' )
     510                                );
     511                        }
    494512                }
    495513
    496514                if ( current_user_can( 'delete_term', $tag->term_id ) ) {