Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #32786, comment 6


Ignore:
Timestamp:
06/26/2015 12:40:03 PM (11 years ago)
Author:
boonebgorges

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32786, comment 6

    initial v1  
    11Thanks all. As a rule, I think what's being encouraged here is not very good practice. Functions that are supposed to return a string (in this case, a URL) should not simply return `null` when bad input is provided. Ideally, they'd return a meaningful error object. But, in the absence of that, a PHP notice can be a helpful debugging tool for developers. If you're passing a bad term ID or a bad taxonomy name to `get_edit_term_link()`, you should know about it.
    22
    3 All this being said, the function is already odd in the sense that it bails with `null` when the cap check is not met. So, for the sake of consistency, it shouldn't do any harm to patch as suggested.
     3All this being said, the function is already odd in the sense that it bails with `null` when the cap check is not met. And we can't change the function to return `WP_Error` objects, as plugins (and WP itself) sometimes checks `! $link = get_edit_term_link()` for failure. So, for the sake of consistency, it shouldn't do any harm to patch as suggested.