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
- Custom User Role not working
- Check if a value exists in database table
- Add a field into a shortcode of an extension
- Way to redirect all Product Sub Category to its Main category Page?
- How to insert class in each list of categories?
- How can I show immediate and/or parents in a title?
- Prevent loading of functions
- Why is it so hard to add a class to the tag in the sidebar widget?
- Add Login/Logout Menu Item to Primary Nav “My Account” Submenu [Woocommerce] [closed]
- Can’t add_action to ‘save_post’ and get it to fire
- Parent theme styles overriding child theme CSS [closed]
- Convert multiple logos into the_custom_logo
- $_Get and &_REQUEST Index Undefined on Functions.php
- How to change value of variable in theme file with functions.php WordPress?
- The correct way to add a JavaScript in the functions.php [closed]
- I can’t add CSS with functions.php
- Where is this JQuery coming from?
- How to remove some item from WordPress Dashboard for user Author
- Exclude Category ID in function
- Different favicon on different pages
- How can I set the SRC URL of the custom logo image?
- Javascript not loading after the document ready
- The Capability to choose post/page template
- Theme JS is available but theme CSS isn’t
- Genesis Framework: How to exclude a specific author from archive custom loop
- Need To Change WordPress Meta Tags… Includes wordpress shortcodes
- Problem with calling custom function in a foreach loop
- Need to convert image url to a Base_64 data url with wordpress function..
- How to Add Shortcode to html img code?
- processing form data with ajax
- Check from functions.php if function exists in footer.php
- The_content and Preg_replace in loaded Iframe [closed]
- Logout Redirect and also WP-login.php Redirect
- Proper Way to Load stylesheet on Condition
- Hide tab Buddypress profile for visitors, not logged in users
- Insert Address fields into function
- Passing user enetered value in widget: number of words, for example
- Create a Woocommerce product widget with category filter