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
- BuddyPress Edit activity function good practice
- How to create an onclick event on an image in a post?
- Allow Contributor to edit their own posts after Adm aproval
- help I changed one currency in woocommerce and everything is ruined [closed]
- How to run a function in every page, every device
- How to ignore posts in pre_get_posts?
- How to retrieve the values of a sub-field in the first and last row of an (ACF) repeater inside function?
- New functions in separate directory — better, portable way
- WordPress Migration error phpupdate_option is not a function
- Custom Query Not Paginating
- Solved: redirect to another page using functions.php
- Ajax resetting my global variable
- Problem enqueuing scripts on not single posts
- referencing the current user in a page i created in wordpress
- is_main_query() always returning false
- Undefined variable issue for wp_get_attachment_image_url
- Counting posts and trigger it [closed]
- ACF Flexible in TCPDF
- modifying every other element’s class inside while loop
- Adding Custom Body Class for Page: Shop
- “Conditional query tags do not work before the query is run. Before > then, they always return false. “
- Change ‘Categories’ to ‘Topics’
- Is it possible to use ‘wp_insert_post’ function within a for loop?
- save_post function keeps triggering: Warning: array_map(): Argument #2 should be an array… when restoring from trash
- Restoring pages in wordpress
- Redirect after login to current URL
- Different body image backgrounds on different pages, posts and categories
- Language switcher for subdomains
- Function to draw random image from specified category destroys site logic – why?
- Issues with add_query_arg() not passing a variable
- Add Function For Instances of Custom Text in Multiple Category IDs to display in post content
- Move captions under gallery images in twenty fourteen theme
- How to add a class name to the ancestor of a post?
- Retrive post by tags PHP code
- Sorting date results from a query
- Add custom css to theme
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- function to show youtube videos within excerpt – if condition and apply_filters
- sort by date in users