WordPress.org

Make WordPress Core

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


Ignore:
Timestamp:
02/05/2017 12:49:05 PM (5 years ago)
Author:
flixos90
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #34699, comment 6

    initial v1  
    11IMO it makes sense to introduce this function. While it is not that complex to do it manually at this point, a function like that would still allow for cleaner code and it also makes sense to introduce this function for parity. We have `add_query_arg()` and `remove_query_arg()`, so one could easily assume there is also `get_query_arg()`.
    22
    3 I provided a new patch, where `$key` is also supported to be an array, so it works in the same way like the other two functions. Open question: If `$key` is an array and one of its keys is not available as query argument, should the result array include the key with value `NULL` or should it just be left out? For `isset()` it wouldn't matter, but for `array_key_exists()` it would. Leaving it out would make the function code a bit simpler, but it would also mean there could be notices if a user simply tries to access a key that is not set.
     3I provided a new patch with [attachment:34699.diff], where `$key` is also supported to be an array, so it works in the same way like the other two functions. Open question: If `$key` is an array and one of its keys is not available as query argument, should the result array include the key with value `NULL` or should it just be left out? For `isset()` it wouldn't matter, but for `array_key_exists()` it would. Leaving it out would make the function code a bit simpler, but it would also mean there could be notices if a user simply tries to access a key that is not set.
    44
    55This function would still need to unit tests, in case the decision is to introduce it. I'll gladly provide those after we have it figured out.