[wp-trac] [WordPress Trac] #36201: Admin Pagination URLs Use Wrong Hostname

WordPress Trac noreply at wordpress.org
Thu Apr 25 15:03:19 UTC 2019


#36201: Admin Pagination URLs Use Wrong Hostname
-------------------------------------------------+-------------------------
 Reporter:  grimmdude                            |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Administration                       |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing dev-         |     Focuses:
  feedback close                                 |
-------------------------------------------------+-------------------------

Comment (by ooglek):

 Let's make this happen! Is the best path here using admin_url(),
 get_option('siteurl'), get_site_url() or some other replacement for the
 hardcoded {{{ $_SERVER['HTTP_HOST'] }}} ?

 {{{ admin_url() }}} calls {{{ get_admin_url() }}} which calls {{{
 get_site_url() }}} which calls {{{ get_option('siteurl') }}}

 It seems {{{ admin_url() }}} is a higher level method and better place to
 start. The original diff seems appropriate.

 There are only three places left in the wp-admin/ directory where
 HTTP_HOST is referenced:

 in misc.php 5.1.1

 {{{#!php
 <?php
 1164
 1165     // Ensure we're using an absolute URL.
 1166     $current_url  = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST']
 . $_SERVER['REQUEST_URI'] );
 1167     $filtered_url = remove_query_arg( $removable_query_args,
 $current_url );
 }}}

 In class-wp-list-table.php 5.1.1

 {{{#!php
 <?php
  796         $removable_query_args = wp_removable_query_args();
  797
  798         $current_url = set_url_scheme( 'http://' .
 $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
  799
  800         $current_url = remove_query_arg( $removable_query_args,
 $current_url );
 }}}

 and

 {{{#!php
 <?php
 1080         list( $columns, $hidden, $sortable, $primary ) =
 $this->get_column_info();
 1081
 1082         $current_url = set_url_scheme( 'http://' .
 $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
 1083         $current_url = remove_query_arg( 'paged', $current_url );
 1084
 }}}

 Let's fix this.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/36201#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list