Well, you can get sites with get_sites and loop through them:
if ( function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
$sites = get_sites();
foreach ( $sites as $site ) {
// do something
}
return;
}
Related Posts:
- Prevent “main” WPMU site_url() being returned in functions
- Implementing DNS Prefetching with WordPress
- Different functions file for each site in multisite installation?
- Delete pages and Create default pages for all new network sites
- Multisite, either change the name of sample-page or create new page
- Global functions on WPMU
- restore_current_blog required after switch_to_blog, if I use that in a function?
- Run function when WordPress new multisite is created or ACF field is updated
- Conditional Gravity Forms filter in WordPress Multisite
- Multisite Ajax serialize return error [object Object]
- Creating new blog on multisite programatically without hacks?
- How to get correct URLs in network wide menu (Multisite)?
- Multisite 404 on pages – rewrite error breaks database
- Has is_archived() for sites in a multisite changed with WP 4.7?
- Function that outputs second theme url
- dynamic site link for future migration in echo do_shortcode()
- wp_get_attachment_image_src returns image on main domain, false on subdomain
- functions.php return custom text
- Dashboard blocker on network multisite for specific user roles
- Members only function, but allow account activation [solved]
- Competing Login Redirects – Need to be Combined?
- Adding a class to the body of an inactive site using multisite
- Run function from parent on child site
- Ads Only at one website inside multisite network – code error
- Different ads on every website on multisite environment
- When should you, and when should you not, use wp_list_pluck()?
- Difference between the_permalink() and get_permalink() function
- Include PHP file in Content using [shortcode]
- How to show product SKU on product page
- Gettext details
- Calling a function from functions.php in header [closed]
- Why get_header() or get_footer() does not run twice if called in the same php file?
- Create thumbnail on PDF upload with Gravity Forms
- jQuery plugin function is not a function
- I changed “Howdy” in the admin bar in the dashboard, but when I’m viewing the site it still says Howdy!
- Custom logo sizes for multiple logos
- how to change link of some wordpress pages
- Menu fallback “menu_class” rendering a “div” instead of a “ul”
- Change Rating range in Link Manager
- Create single.php for specific tag by tag id or name
- function to erase swear words
- str_replace function in theme
- Function call via ajax – can’t figure it out?
- How to add nav menu items to a specific position within a menu
- woocommerce: change default setting > is_sold_individualy function
- How to add a slide toggle to the Woocommerce-Layout__Activity-Panel area in the orders admin page
- WordPress Menuing Question :focus
- call of javascript function to external url always blocked by cors
- wp-comment author- url +, email filter hook
- What WordPress function to use to get meta value by using meta keys?
- how can I just add to parent theme function(s) instead of redeclaring whole the function
- Create a custom taxonomy that will be used to create and filter markers in a Google Map
- Adding an external HTML link to a post thumbnail
- Remove adjacent_posts_rel_link under 3.2?
- enqueue_script with filemtime javascript not working
- WP function won’t work on 404 template page
- How to obtain the recent posts without their content in an efficient way?
- wp_redirect only works on main site and not on other sites
- Limit dimensions of “Full” size images
- Where to put random functions?
- Define PHP variable from a seperate API if statement
- Auto-Tweet if Type is ‘Status’ using OAuth
- Output a specific link in WordPress post if the single post’s category’s name contain certain word
- Passing user enetered value in widget: number of words, for example
- Adding a section in line at the end of the main navigation menu in php
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- Suggest Users basing on User taxonomy
- update_post_meta is Updating with two page id
- Custom Image Size in Insert Media
- Custom function for search form
- Custom Menu in Admin doesn’t change menu in browser
- How can I show different content for different user-levels?
- WordPress function bloginfo not echoing output on parts of the pages
- How to change a meta value (of a published post) after X days.?
- sort metabox columns in listing Single
- wp_nav_menu displaying all pages
- Why should I use get_template_directory() when include files?
- How to display an image before title text in menu items
- Error in “class-wp-hook.php”
- How to replace ACTION url from original wordpress login form?
- Redirect User Role When on Specific Page
- How to force one script to load before google tag manager script
- Ajax in plugin fails – but only on one blog – no idea why
- I can’t in any way include css in my theme using functions.php
- Problem with email function
- admin-ajax.php 403 forbidden only when calling from external file
- Display list of pages that contain a certain string within the slug
- I need to completely ‘wp_dequeue_script’; what’s the best way?
- $content is empty while using DOMDocument
- Change the second role depending on the first
- Problem with add_rewrite_tag
- getExcerpt: Make ellipsis appear only if character limit is reached
- Modify function Shortcode_atts
- How do I change the URL returned by next_posts_link()?
- Woocommerce – Checkout error message
- Problem with lists and “allowed_block_types” in functions.php (since WP 6.1.1)
- Create section wit form
- Child theme’s functions.php not being read (child theme’s autoload.php not being run)
- How to use: WP_AJAX_GET_COMMENTS
- wp_insert_post inserts 3 posts at once?