• Resolved wowcroftynm

    (@wowcroftynm)


    Hello:

    I would like to change the URL which opens when someone clicks the ‘View Website’ in the Admin Bar for all users. How can I do this? Thank you in advance for your assistance.

    Regards,

    Matt

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Matt –

    As you know, that link brings you to the live homepage of your website. May I inquire as to why you wish to change that? Or specifically, what you are trying to accomplish?

    Here’s some documentation on the home_url function in WordPress:
    https://developer.www.ads-software.com/reference/functions/home_url/

    You could modify the script to set a different value, but this may affect more than just the link in the admin bar.

    -Dan

    Thread Starter wowcroftynm

    (@wowcroftynm)

    Dan:

    I am looking to modify the URL because anyone who is logged in will actually need to go to a different home page when clicking on the link. My site has three separate home pages, and the one which is redirected depends upon the user logging in. However, anyone who has access to the Admin dashboard share the same page, but again, it is different from the public home page. In which file(s) might I find the script? And what could be the disadvantages to modifying it? Thanks much for your response.

    Regards,

    Matthew

    You’ll need to modify the functions.php file to tell WordPress what you want the link to be. The risk is that changing it could affect other links in the admin area, so some testing will be required. I found some helpful advice on StackOverflow.com … if you search for “modify admin bar link”. You’ll find some examples of how people modified the admin bar in general.

    Thread Starter wowcroftynm

    (@wowcroftynm)

    Hello Dan:

    Are you able to provide a specific block of code I may insert into functions.php? I checked Stack Overflow, but all posts related to the admin bar did not involve changing the URL. Thank you so much for your continued assistance!

    Regards,

    Matthew

    Hi Matthew –

    I’m not a great resource when it comes to coding (LOL, sorry). However, have you tried searching for “stackoverflow: modifying home_url WordPress” or just “modifying home_url WordPress” in general? I think if you scroll through a few articles, you’ll find some code snippets and “filters” you may be able to leverage.

    -Dan

    Thread Starter wowcroftynm

    (@wowcroftynm)

    Thank you for your suggestions. I will continue looking for a solution.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change Admin Dashboard View Site’ is closed to new replies.