Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #60835, comment 71


Ignore:
Timestamp:
06/27/2024 10:40:45 PM (20 months ago)
Author:
peterwilsoncc
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #60835, comment 71

    initial v1  
    66
    77> Yea, I agree a lambda callback to a filter is somewhat unusual in core. It is quite common in plugins. However I don't see how that is a "maintenance burden" especially after the decision to revisit this code early in WP 6.6. I also don't see how using a lambda function is "against the coding standards". It is undesirable as those filter callbacks cannot be removed (easily). However in this particular case the fact that this is non-removable prevents plugins from mangling the Uploads API.
    8 
    9 > Yea, I agree a lambda callback to a filter is somewhat unusual in core. It is quite common in plugins. However I don't see how that is a "maintenance burden" especially after the decision to revisit this code early in WP 6.6. I also don't see how using a lambda function is "against the coding standards".
    108
    119Please refer to the coding standards on [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#closures-anonymous-functions closures]: "Closures should not be passed as filter or action callbacks, as removing these via remove_action() / remove_filter() is complex"