0

I've put / in my Home custom page link, and locally my server is localhost:3000 and it works fine, but on my server the url is www.mysite.com/theproject, but / there does not lead to www.mysite.com/theproject but to www.mysite.com, but for example the logo which has a link like so <?= esc_url(home_url('/')); ?> works fine on the server.

Any way to make the custom page link behave like it has <?= esc_url(home_url('/')); ?> ?

  • /theproject ? – Adam Mar 9 '16 at 11:22
  • yes, the website itself is not hosted at the root of the server but in a subfolder – dzimi Mar 9 '16 at 12:51
  • Yeah I know, I'm saying... make your custom link, /theproject or use the nav_menu_link_attributes filter to change the `href' of the specific item. You can also set a home link that will resolve to the base path of your installation by using the Menu manager in the dashboard. – Adam Mar 9 '16 at 15:07
0

For the url to the root of the Wordpress installation you can use:

<?php echo site_url(); ?>

see: https://codex.wordpress.org/Function_Reference/site_url

Edit: please check your url settings in the general Wordpress settings.

Your Answer

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

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