Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#55322 closed defect (bug) (invalid)

The Class WP-Post List Table(Method - Column_Default) Contains Irrelevant Keyword 'return'

Reported by: cu121's profile cu121 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: Posts, Post Types Keywords:
Focuses: administration Cc:


The Class WP-Post-List-Table has a method 'Column_Default' which contains a 'return' statement that prevents hooks from being fired like(hooks:- manage_pages_custom_column, manage_posts_custom_column, manage_{$post->post_type}_posts_custom_column). The return statement is on line number 1302, File-Name:- class-wp-posts-list-table.php.

Change History (5)

#1 @SergeyBiryukov
2 years ago

  • Component changed from Administration to Posts, Post Types
  • Version changed from 5.9.1 to 3.5

Hi there, welcome back to WordPress Trac! Thanks for the report.

For reference, the return statement was technically added in [32740] / #29881, but it replaced an earlier break statement added in [21788] / #21240, so WordPress 3.5 appears to be the earliest affected version here.

#2 @joyously
2 years ago

The return isn't irrelevant.
That if statement handles only taxonomy columns, and it runs the appropriate filter.
The actions further down are for custom columns, which the taxonomy column is not, so they should not be run in that case.

#3 @cu121
2 years ago

I see I was checking for taxonomy basically. I guess this ticket can be closed.
Thank You For The Explaination

#4 @costdev
2 years ago

  • Keywords dev-feedback needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Thanks for opening this ticket @cu121!

As @joyously explained:

  • When the column is categories, tags, or starts with taxonomy-:
    • Handle the taxonomy and return.
  • Otherwise:
    • Run an appropriate action hook depending on whether the post type is hierarchical (yes = Pages hook, no = Posts hook).
    • Finally, run the action hook for the specific post type.

I'll close this ticket as invalid, as the method returns at an appropriate time.

Thanks to all for their insight on this.

Last edited 2 years ago by costdev (previous) (diff)

#5 @cu121
2 years ago

@costdev thank you so much for the explanation :)

Note: See TracTickets for help on using tickets.