WordPress.org

Make WordPress Core

Ticket #34699: 34699.patch

File 34699.patch, 1.1 KB (added by sebastian.pisula, 6 years ago)
  • wp-includes/functions.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    844844}
    845845
    846846/**
     847 * Get an item from a query string.
     848 *
     849 * @since 4.4.0
     850 *
     851 * @param string|array $key   Query key or keys to remove.
     852 * @param bool|string  $query Optional. When false uses the current URL. Default false.
     853 *
     854 * @return string|null Value of key item
     855 */
     856
     857function get_query_arg( $key, $query = false ) {
     858
     859        if ( $query === false) {
     860                $query = $_SERVER['REQUEST_URI'];
     861        }
     862
     863        $url = parse_url( $query );
     864
     865        if ( isset( $url['query'] ) ) {
     866
     867                parse_str( $url['query'], $output );
     868
     869                if ( isset( $output[ $key ] ) ) {
     870                        return $output[ $key ];
     871                }
     872        }
     873
     874        return null;
     875}
     876
     877/**
    847878 * Returns an array of single-use query variable names that can be removed from a URL.
    848879 *
    849880 * @since 4.4.0