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.
Related Posts:
- Getting the Site URL Including the Front Base
- Setting a permalink for the home page?
- WordPress Permalinks on Mac OSX Server 5 (El Capitan)
- Multilanguage URLs
- How to show the homepage on a different url, like site.com/blog instead of site.com?
- After updating to 4.8 permalinks will not work (all 404)
- Moving local wordpress page to a real server subdomain broke my permalinks?
- Migrated from Windows to Linux. Any bulk methods for fixing case sensitivity?
- curl problem or permalinks
- Add post overwriting permalink from previous post in 4.6
- home_url on IIS missing permalink index.php
- how to set up wp in folder within static website?
- WordPress switch servers
- Problems fixing a REST API 404 after Moving my WordPress Directory and updating Permalink Structure
- Got 404 error when changed siteurl via DB in WordPress
- Logging in to installation in subdirectory renders broken dashboard (no CSS, broken links)
- Get value from URL with different types of parameters
- Stop WordPress appending `-2` to the end of my url after i change it
- WordPress Permalinks not working in Apache2 Ubuntu 14.04
- Get current URL (permalink) without /page/{pagenum}/
- Removing Parent Page(s) from Permalink
- Removing the redirect after changing a page’s slug
- How to display a public profile page for registered users with custom slug?
- Permalink Issues by Installing WordPress in Subdirectory / Subfolder
- nginx – permalinks with .php in url not working
- Nice RSS Feed URLs for each custom post type
- Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?
- Should I use relative or absolute urls when pointing to internal pages
- removed index.php now all pages 404
- Gutenberg Editor: dynamicaly change slug field with an ACF field
- Permalinks all messed up, I am helpless [closed]
- WordPress | Convert #038; to &
- Can’t get rewrite rules working
- permalink changed, now getting 404 for every pages
- How to write correct add_rewrite_rule in WordPress for more than one taxonomy in one rule?
- When is it a good idea to build a permalink structure from scratch?
- Permalinks not working Apache + CentOS 7
- How can I link a file in admin with a button?
- Remove Dash/Hyphen From WordPress CustomPosttype Permalink
- Auto-create a pretty permalink for a bunch of posts
- Post incorrectly displaying as page
- wp_logout_url redirects to incorrect page because of pagination
- why does my url not update after migration?
- Dynamically create Permalinks for uploaded files?
- Get new WordPress slug from old wordpress slug
- Moved page (new parent) loads properly using obsolete URI. Why?
- Rewrite rule for a query string
- Custom Permalinks for Posts only
- Is it possible for a custom post type and sub pages of a page with the same slug as the custom post type to share a slug?
- Why is page/2/ not working?
- Removing leading zeros from custom permalink structure
- Permalinks stopped working – NO update, mod_rewrite enabled, .htaccess not touched
- Add more structure tag to permalink?
- wp_publish_post to saved draft, permalinks broken
- display dynamic content based on url slug on custom page
- Default permalink changes
- Slugs Disappeared Leaving 404s – Quick way to repopulate?
- Path to Pages Resolves to Archive instead of Actual Content
- permalink %year% of pre-written posts to be published next year, in the mysterious future (*)
- Changing permalink name redirects to another template?
- Permalink slug no longer editable when using post_type_link filter
- add_query_vars and canonical links
- Changing the permlink and SEO
- whats the mistake → href=”get_permalink() [closed]
- Remove some rewrite rules in wordpress
- How to change permalinks
- How can I link to the author’s page
- WordPress pages and posts are redirecting to server IP address instead of domain URL [closed]
- Would it be wrong to save the permalinks as a postmeta and regenerate it on save post? [closed]
- How to: change permalink by category?
- Passing variable as permalink URL
- new page redirect to old page which had the same permalink
- Customizing a permalink
- Long permalinks get split with multidots and get broken
- Will permalinks work if blog is transferred to subdirectory?
- How to remove slug from front page?
- Find all URLs for a post
- Homepage template and url changed?
- Multiple URL rewrite rules and get every prams
- Passing parameter through permalink structure
- Add word to permalinks does not transform the urls
- Subpages getting a 404 error after changing Parent page URL
- Automatisation permalinks for each making of new page
- Remove link function from oembed image or video
- How do WordPress permalinks work?
- WordPress permalinks error 404 on IIS
- Remove/hide a specify category-name from the url
- WordPress automatically adding extra -1 or slug postfix while updating a sub category item
- How can I get .html URL suffixes in permalinks?
- Removing or hiding slug/permalink from htaccess
- Converting WP Page to use full explicit paths?
- Add Custom Pagination Permalink
- Pages included in another page and duplicate content issues for SEO
- WordPress archive posts returns user to homepage
- URL to an image in a post is changing when permalink is set to custom. Can I avoid this?
- How can i edit all posts slug in bulk keeping WP native redirect?
- Post/page without slug
- Blog url disappears
- Permalinks get lost periodically
- Stymied by 500.5 error for WordPress on IIS 8 / Windows Server 2012