[wp-trac] [WordPress Trac] #27888: Feature request: `get_current_admin_url()` and `get_current_admin_hook()`

WordPress Trac noreply at wordpress.org
Tue Sep 20 22:30:48 UTC 2016


#27888: Feature request: `get_current_admin_url()` and `get_current_admin_hook()`
-------------------------------------------------+-------------------------
 Reporter:  Denis-de-Bernardy                    |       Owner:
     Type:  feature request                      |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Administration                       |  Review
 Severity:  normal                               |     Version:  3.9
 Keywords:  needs-unit-tests good-first-bug      |  Resolution:
  has-patch needs-testing                        |     Focuses:
                                                 |  administration
-------------------------------------------------+-------------------------

Comment (by PerS):

 @jorbin, sample use case: I borrowed this function and use it in admin bar
 menu, allowing me to return to the page I was on when returning from the
 customizer, eg:

 {{{#!php
 <?php
 function add_admin_bar_customizer_url( $wp_admin_bar ) {
         global $post;
         $return_url = ( is_admin() ) ?
 $this->_get_current_admin_page_url() :  get_permalink( $post->ID );

         $args = array(
                 'id' => 'plugin-customizer-link',
                 'title' => __( 'Plugin Customizer', 'plugin-customizer' ),
                 'href' => $this->_get_customizer_url( $return_url,
 'plugin_settings_panel' ),
         );

         $wp_admin_bar->add_node( $args );
 }
 }}}

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


More information about the wp-trac mailing list