我正在尝试获取单个站点的子站点选项值,但从站点返回false值。我确实尝试了get_site_option,get_option和get_blog_option,但是我的代码不起作用
$sites = function_exists('wp_get_sites')? wp_get_sites(array('limit'=>9999)) : get_blog_list(0,'all');
$response=array();
$i= 0 ;
foreach( $sites as $site ) {
if( $site['blog_id'] != '' ) {
//$options = (is_multisite()) ? get_site_option($this->option_name) : get_option($this->option_name);
echo "test".get_blog_option($site['blog_id'] , 'wp_31_start_date');
switch_to_blog( $site['blog_id'] );
echo $value = get_site_option( 'wp_31_start_date' );
echo $value1 = get_option( 'wp_31_start_date' );
restore_current_blog();
$title = get_blog_details($site['blog_id'])->blogname;
$url = is_subdomain_install() ? "$site[domain]" : "$site[domain]$site[path]";
// Response of sucess
$response['allsites'][$i]['ID'] = $site['blog_id'];
$response['allsites'][$i]['name'] = substr( $title,0,30 );
$response['allsites'][$i]['url'] = esc_url( get_home_url( $site['blog_id'], '/' ) );
//$response['allsites'][$i]['status'] = 'Site '.$site['blog_id'].' was updated '.get_blog_status( $site['blog_id'], $preference );
}