[wp-trac] [WordPress Trac] #16502: Quick Edit contents should only be rendered if quick edit button in actions after filtering

WordPress Trac noreply at wordpress.org
Fri Sep 2 11:47:02 UTC 2022


#16502: Quick Edit contents should only be rendered if quick edit button in actions
after filtering
-------------------------------------------------+-------------------------
 Reporter:  wyrfel                               |       Owner:  chriscct7
     Type:  enhancement                          |      Status:  reviewing
 Priority:  normal                               |   Milestone:  6.1
Component:  Quick/Bulk Edit                      |     Version:  3.0.4
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing has-         |     Focuses:
  testing-info changes-requested                 |  performance
-------------------------------------------------+-------------------------
Changes (by costdev):

 * keywords:  has-patch needs-testing => has-patch needs-testing has-
     testing-info changes-requested


Comment:

 == Test Report

 Patch tested: https://github.com/WordPress/wordpress-develop/pull/3152

 === Steps to Reproduce or Test
 1. Create a new file `wp-content/plugins/test-16502.php` with the
 following contents:
 {{{#!php
 <?php
 /**
  * Plugin Name: Test #16502
  * Description: For testing <a
 href='https://core.trac.wordpress.org/ticket/16502'>16502</a>.
  * Author:      WordPress Core Contributors
  * Author URI:  https://make.wordpress.org/core
  * License:     GPLv2 or later
  * Version:     1.0.0
  */

 add_action( 'init', 'test_16502_cpt' );
 add_action( 'admin_bar_menu', 'test_16502_adminbar', 999 );
 add_filter( 'post_row_actions', 'test_16502_hide_quick_edit', 10, 1 );
 add_filter( 'page_row_actions', 'test_16502_hide_quick_edit', 10, 1 );
 add_filter( 'tag_row_actions', 'test_16502_hide_quick_edit', 10, 1 );

 function test_16502_cpt() {
         register_post_type( '16502', array( 'public' => true, 'label' =>
 'Test 16502' ) );
 }

 function test_16502_adminbar( $wp_admin_bar ) {
         global $pagenow;
         $action = empty( $_GET['hide_quick_edit'] ) ? '1' : '0';
         $url    = add_query_arg( array_merge( $_GET, array(
 'hide_quick_edit' => $action ) ), admin_url( $pagenow ) );
         $wp_admin_bar->add_node( array( 'id' => 'test-16502', 'title' =>
 $action ? 'Remove Quick Edit' : 'Add Quick Edit', 'href' => $url ) );
 }

 function test_16502_hide_quick_edit( $actions ) {
         if ( ! empty( $_GET['hide_quick_edit' ] ) ) unset(
 $actions['inline hide-if-no-js'] );
         return $actions;
 }
 }}}
 2. Navigate to `Plugins > Installed Plugins` and activate **Test #16502**.
 3. Navigate to `Posts`.
 4. Open DevTools and inspect a post's title.
 5. Below the post's title `<strong>` markup, there will be `<div
 class="hidden" id="inline_XXXX">` element.
 6. In the admin bar, click "Remove Quick Edit".
 7. 🐞 Repeat steps 4-5.
 8. Click "Add Quick Edit".
 9. Apply the PR.
 10. ✅ Repeat steps 3-7.

 You may also test the following screens:
 - `Posts > Categories`
 - `Posts > Tags`
 - `Pages`
 - `Test 16502`

 === Expected Results
 When reproducing a bug:
 - ❌ The hidden "inline_XXXX" element should exist even though "Quick
 Edit" is removed.

 When testing a patch to validate it works as expected:
 - ✅ Posts (and other screens): The element should no longer exist when
 "Quick Edit" is removed.

 === Environment
 * Server: Apache (Linux)
 * WordPress: 6.1-alpha-53344-src
 * Browser: Chrome 104.0.0.0
 * OS: Windows 10
 * Theme: Twenty Twenty-Two
 * Plugins:
   * Quick Edit Inline 1.0.0

 ==== Actual Results
 When reproducing a bug/defect:
 - ✅ Issue reproduced: The hidden "inline_XXXX" element still exists even
 though "Quick Edit" is removed.

 When testing the bugfix patch:
 - ✅ Posts: The hidden "inline_XXXX" element no longer exists when "Quick
 Edit" is removed.
 - ✅ Pages: The hidden "inline_XXXX" element no longer exists when "Quick
 Edit" is removed.
 - ✅ Custom Post Type (Test 15602): The hidden "inline_XXXX" element no
 longer exists when "Quick Edit" is removed.
 - ❌ Tags: The hidden "inline_XXXX" element still exists even though
 "Quick Edit" is removed.
 - ❌ Categories: The hidden "inline_XXXX" element still exists even though
 "Quick Edit" is removed.

 === Notes
 - The patch works for Posts, Pages and Custom Posts Types, so this
 **could** be committed as-is.
 - However, IMO, the patch should fix Tags and Categories too.
 - Also, I didn't get to test with `Comments`, but I think the patch should
 cover this too.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/16502#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list