WordPress.org

Make WordPress Core

Ticket #27888: 27888.diff

File 27888.diff, 559 bytes (added by mwtsn, 3 years ago)

Patch to add a get_current_admin_page_url() function into wp-admin/includes/misc.php. This is my first patch, so be gentle with me when feeding back.

  • wp-admin/includes/misc.php

     
    936936        </script>
    937937        <?php
    938938}
     939
     940/**
     941 * Outputs the current admin page url
     942 */
     943function get_current_admin_page_url() {
     944
     945        if ( ! is_admin() ) {
     946                return false;
     947        }
     948
     949        global $pagenow;
     950
     951        $url = $pagenow;
     952        $query_string = $_SERVER['QUERY_STRING'];
     953
     954        if ( ! empty( $query_string ) ) {
     955                $url .= '?' . $query_string;
     956        }
     957
     958        return $url;
     959}