is_current_blog_previewed() public méthode

Return true if the current site is not the same as the previewed site.
Since: 4.2.0
public is_current_blog_previewed ( ) : boolean
Résultat boolean If preview() has been called.
 /**
  * Ensure that previewing a setting is disabled when the current blog is switched.
  *
  * @ticket 31428
  * @group multisite
  */
 function test_previewing_with_switch_to_blog()
 {
     if (!is_multisite()) {
         $this->markTestSkipped('Cannot test WP_Customize_Setting::is_current_blog_previewed() with switch_to_blog() if not on multisite.');
     }
     $type = 'option';
     $name = 'blogdescription';
     $post_value = rand_str();
     $this->manager->set_post_value($name, $post_value);
     $setting = new WP_Customize_Setting($this->manager, $name, compact('type'));
     $this->assertFalse($setting->is_current_blog_previewed());
     $this->assertTrue($setting->preview());
     $this->assertTrue($setting->is_current_blog_previewed());
     $blog_id = self::factory()->blog->create();
     switch_to_blog($blog_id);
     $this->assertFalse($setting->is_current_blog_previewed());
     $this->assertNotEquals($post_value, $setting->value());
     $this->assertNotEquals($post_value, get_option($name));
     restore_current_blog();
 }