Can you try out the following code somewhere and post the output?
$mySites = wp_get_sites($args);
foreach ($mySites as $blog){
print_r(get_blog_status($blog['blog_id'], 'archived'));
}
If this works, I suspect the code behind is_archived()
used to understand blog-objects, but the function is supposed to recieve only the blog ID, not the whole object.
Your code should be the following:
$mySites = wp_get_sites($args);
foreach ($mySites as $blog){
if (!is_archived($blog['blog_id'])){
switch_to_blog( $blog['blog_id'] );
printf( '%s<a href="https://wordpress.stackexchange.com/questions/249214/%s">%s</a></li>' . "\r\n", $TagLi, home_url(), get_option( 'blogname' ) );
restore_current_blog();
}
}
Related Posts:
- Conditional Gravity Forms filter in WordPress Multisite
- Prevent “main” WPMU site_url() being returned in functions
- WordPress function like is_category for subcategory? is_subcategory?
- deregister scripts on certain page
- Implementing DNS Prefetching with WordPress
- How to update WordPress and plugins at specific day and time in PHP?
- is_front_page not working in functions.php
- disable comments if array exists
- Problem using is_single() to enqueue script from functions.php
- Conditional tag is_page with a custom post type
- Different functions file for each site in multisite installation?
- Limit posts only on home page – ideally in functions.php
- Delete pages and Create default pages for all new network sites
- Multisite, either change the name of sample-page or create new page
- Loop (iterate) through Multi-Site sub-sites (blogs)?
- Global functions on WPMU
- restore_current_blog required after switch_to_blog, if I use that in a function?
- Enqueue scripts not working with if is page conditional tag in functions.php
- Run function when WordPress new multisite is created or ACF field is updated
- Conditional read more adjustment
- Which action does wp_update_user triggers?
- How add various functions within 1 conditional?
- 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
- Update user meta of author when post content is viewed
- Redirect to another page using contact form 7? [closed]
- Function that outputs second theme url
- Testing for a shortcode using a function. 404 page throwing PHP Notice
- is_page() or is_single not working
- functions.php and conditional tags
- issue with if/elseif in_array inside foreach loop display only one post
- Set “woocommerce_is_purchasable” to false for specific “$product->is_stock_status”
- dynamic site link for future migration in echo do_shortcode()
- wp_get_attachment_image_src returns image on main domain, false on subdomain
- Entirely Different Functions.php per Page?
- functions.php return custom text
- Function to echo (or display?) wordpress tags in the head section
- is_home() not working in functions.php file
- If is_single in functions.php
- Dashboard blocker on network multisite for specific user roles
- Members only function, but allow account activation [solved]
- Enqueue script if not page template
- is_product_category(‘Services’) not working
- Competing Login Redirects – Need to be Combined?
- Adding a class to the body of an inactive site using multisite
- method to fetch entire tag list on archive.php
- Adding an IF ELSE to a function
- how to display featured image for single post for a specific category
- Load CSS conditional on custom field is present
- admin-ajax.php nulls all php variables
- restrict access to specific urls on a specific period of time
- Change conditional tag in wordpress without editing the core files
- WordPress not performing direct update
- Run function from parent on child site
- wp_enqueue_scripts called twice?
- How can i hide content if not friend in Buddypress? [closed]
- PHP Notice: Function is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false
- Ads Only at one website inside multisite network – code error
- Different ads on every website on multisite environment
- Possible to search by author name with default WordPress search function?
- Customize default settings on new sites on multisite
- Influence of WordPress functions on site speed
- Is it possible to override this function/class in a child theme?
- When new user register then add new user role
- Remove bulk actions based on user role or capabilities
- Set first oembed in post to a global variable or function
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- wp_delete_attachment
- WordPress registration and contact form 7 [closed]
- Woocommerce checkout field maxlength, make input number field only (postcode)
- My simple custom shortcode is not longer working (possibly due to upgrade to WordPress 4.4 ?)
- PHP files included in functions.php don’t seem to work
- WordPress shortcode attributes for database SELECT?
- How to get membership level for specific user email
- Backstretch.js and thumbnail sizes to reduce loading time
- How do display most popular post from a year earlier to the day?
- Updating Media Published Date When Parent Post Is Modified in WordPress
- Creating A New Admin Menu Tab For Theme Options
- Run wp_kses_decode_entities on atom feed?
- I want to display latest post in marquee [closed]
- Add php code to wp_print_scripts?
- How to get an attachment id from a filename
- Remove ‘page-numbers’ class from prev and next tags
- How can I set the SRC URL of the custom logo image?
- WooCommerce -> wc_enqueue_js not working [closed]
- Use existing image sizes for WooCommerce
- User meta and public function security
- Any adverse effects of adding apply_filters to a function?
- How can I remove page titles without removing the link in the navigation bar in twentyeleven?
- Change WooCommerce Payment Options From Radio Buttons to Dropdown Menu
- Add Change role button for list of user in an event
- Exclude admins from query get posts
- Classic TinyMCE messing up only Contributor’s HTML
- Show users last read posts for each user?
- Disable links to images only if link is an image
- Trying to output a “Most visited blogs” list in wordpress multisite
- Will my WordPress site become vulnerable after adding this functions which allows more HTML tags for subscribers?
- Is storing in a variable the result of a fonction a most powerful way to code an if structures in WordPress?