0

I want when i click on menu button Return to Home i made on wp-admin menu to redirect back to page:

enter image description here

My Extra Code:

            [
                'parentSlug' => 'doesnt-matter',
                'pageTitle'  => 'Return to Home',
                'menuTitle'  => 'Return to Home',
                'capability' => 'doesnt_matter_settings',
                'href' => home_url('/'),
            ],

It shows the button but the link on button is href="admin.php?page" i want example https://domain.com/page01

Any solution?

  • are you using $wp_admin_bar to add the menu? What is your full code? – simongcc Apr 30 at 4:35
  • is a side bar menu of plugin and i want to add extra option to redirect to site from this option i add, so i edited the plugin and add an extra option Return to Home – Fotic Apr 30 at 8:42
  • It looks like your code is no problem. I suggest you consult plugin author or see if there is any filters in the source code. Because it sounds like there is something override. You may also like to disable other plugins to sort out if it is due to some other plugin's override. Because the home_url('/') give the site root url instead of admin url. You may try to find if there is any plugins or code like add_filter( 'home_url', 'something' ) which could override the home_url() result – simongcc Apr 30 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.