Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using wp customizer in a theme and I want to load a page using a link in admin bar. Link in admin bar is added, and link format is like this: http://www.domain.com/dashboard/customize.php?url=/page_to_edit

However, it still loads the homepage in the customizer iframe, so guess I'm doing something wrong. For reference, This is the code I'm using (the part that matters):

$admin_bar->add_menu( array(
        'id'    => 'my_page',
        'parent' => 'customize_page',
        'title' => 'My Page',
        'href' => admin_url( 'customize.php?url=/my_page/'),
        'meta'  => array(
            'title' => __('My Page'),
            'target' => '_self',
            'class' => 'my_menu_item_class'
        ),

Now, if I load the full absolute URL it works fine, but no idea how to make bloginfo load inside this array. I found in another post that I can use get_bloginfo (not sure if that's correct) but also no idea how to make it work after the admin_url part.

Any help really appreciated, this is driving me crazy!

share|improve this question
1  
did you tried - admin_url( 'customize.php?url='. site_url('/my_page/') ) ? –  Shazzad Feb 11 at 1:31
    
Shazzad, this is absolutely perfect, you should have added it as an answer so I could have accepted it. If you do it, I'll accept it anyway, many thanx! :) –  Devin Feb 11 at 1:35

1 Answer 1

up vote 1 down vote accepted

Absolute url can be retrieved with site_url() function. It's similar to admin_url() function, except site_url() is used for front end url's, while admin_url() is for backend url's. So you could try

admin_url( 'customize.php?url='. site_url('/my_page/') )
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.