0

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!

2
  • 1
    did you tried - admin_url( 'customize.php?url='. site_url('/my_page/') ) ? Commented Feb 11, 2014 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! :) Commented Feb 11, 2014 at 1:35

1 Answer 1

2

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/') )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.