site_url
gets you the current sites URL, but you can get the site URL of the root blog at /
via get_site_url
by passing its ID, which is likely to be 1
, e.g.:
$url = get_site_url( 1 );
As an aside, you may find switch_to_blog
and restore_current_blog
to be useful, just know that they’re not cheap to call, and it won’t load code from the other blog/site, if the other site relies on a custom plugin or filters it won’t be present unless it’s also present on the current site.
Related Posts:
- How to move page template files like page-{slug}.php to a sub-directory?
- What WP folder can I use to write files to?
- get_stylesheet_directory() returns wrong URI… localhost/using vhosts
- Retrieve the template directory URI via global or get_template_directory_uri() every time?
- Move my theme style.css into a folder
- When developing a distributable Theme, does it HAVE to be “inheritable”?
- Can wordpress run in root of existing php site with no theme on index.php but all other WP posts/pages?
- Add a theme via symlink
- Loading files for theme and child theme (Require)
- WordPress page templates in a directory
- Custom URL parameters in template files
- Storing the contents from txt file into The_Contents”
- Is it possible to make *.js and folders visible in theme-editor
- Why am I getting a white screen without a slash at the end of the address?
- ACF Pro make URL Linked in Custom Template [closed]
- Issue On Displaying Pages with Post Name Permalink
- How do I include a partial from a directory below a wordpress theme directory?
- Changing sidebar.php and footer.php depending on URL
- Changing footer depending on URL (poli language site)
- index.php file in wp-content/themes/ folder
- Correct (and secure) way to escape url when using href attribute
- Make theme editor to show all theme’s files
- Extracting Distance from FacetWP Proximity Function to Display in WordPress Template
- WordPress API Menu/Submenu Order
- Form Submitting Error with get_template_part()
- Can’t get staging site to display same way as live site. Completely stumped
- How to call the_excerpt() with tags or the_content() as an excerpt?
- Display a different theme for not logged-in users
- how to test a theme upgrade
- How to set path with WP_Filesystem and ftp base / chroot
- How to add paging to query
- what’s meaning of it when submit a theme?
- How to Modify a Widgets UL and/or LI Classes
- How to remove menus section from WordPress theme customizer
- Returning Variables back into a template
- Getting Permalink within the loop
- Allow users to add custom functions to wordpress theme
- How to add custom template tag in wordpress theme?
- Doubled titles when using All in One SEO with custom template
- What page should I use for a contact form?
- Get attachments by user
- Appending a value to metabox before and after saving
- Modify the Additional CSS section (adding a disclaimer)
- I made a my own theme to WordPress and Admin Menu missing from frontend
- What program can I use to preview my wordpress site?
- How to remove a file included in parent theme with locate_template() via child theme?
- Can’t override template file in child theme
- wp_nav_menu add something before closing container and after last list item
- Simple way to get two language WP site
- How can i initialize a widgetized sidebar (with widgets)
- How do you force a sidebar widget to have a container div around all child widgets?
- Add widgets to available widgets section without changing the theme?
- jQuery not available to other scripts
- Override template file i subfolders
- Does the switch_theme action run when you’re upgrading a theme?
- How to jump to newly posted comment anchor after submit?
- How can I override a require() used in functions.php of parent theme to my child theme
- Best way to develop a new theme on a live site, with new content? [closed]
- Tag Page Not Listing All Posts With Tag
- Can I use WooCommerce in a headless CMS setup?
- How to transfer one domain to another domain without losing theme options (customizer)?
- Do I need to include a textdomain if my theme doesn’t support translation?
- Pagination not working on page template
- How can I prevent posts with no title showing up in my query?
- adding class to excerpt
- How can I wrap all blog posts image with
- Redux Setting on custom created admin page
- Avada Child Theme Development
- WordPress Load Only Page Text
- Using the media library for theme customization
- Never actually adding the action? Or do I have to call the action?
- Tiny MCE custom styles, and preview in the backend
- How can I remove image taxonomy pages from my theme and from Google?
- How can I get dynamic content on my static home page
- WordPress 6.x / PHP 8.x deprecated warnings in development environment
- WordPress custom menu can’t show 3. level submenu
- How to change listing type permlink?
- WordPress theme header.php should I add title meta?
- Problems with cart and pages on _s theme
- Custom post type query with pagination doesn’t work
- Fatal error: Class WP_Customize_Image_Control not found
- How do I remove header/page-title image in farvis theme? [closed]
- Which theme PHP file should be edited in order to change Posts appearance
- How to link post image to post link?
- How to hide blog by id wordpress multisite listing
- Get chronological page order
- Issue on Getting Images URL of the Post Gallery
- How to override wordpress native options with theme options
- Problem with multiple menus in theme
- How to create multiple sidebar areas with a forloop and register_sidebars?
- Saving Permalinks Results in 403 MAMP (Windows)
- Add rel to all images in a post
- Which function(s) to build a paged HTML table
- white spaces on the all sides [closed]
- Feeds are showing where Post archive page should be
- My wordpress site memory exhausted more than 1GB trying to debug with default
- Display first post on each page differently than the others
- Custom Theme functions.php – Using add_settings_field and input type=”file” to set custom logo
- I want to resize post featured image without cropping image. How?
- Image and font support missing in editor when deploying theme remotely