WPSEO_OpenGraph::article_author_facebook PHP Méthode

    public function article_author_facebook()
    {
        if (!is_singular()) {
            return false;
        }
        /**
         * Filter: 'wpseo_opengraph_author_facebook' - Allow developers to filter the Yoast SEO post authors facebook profile URL
         *
         * @api bool|string $unsigned The Facebook author URL, return false to disable
         */
        $facebook = apply_filters('wpseo_opengraph_author_facebook', get_the_author_meta('facebook', $GLOBALS['post']->post_author));
        if ($facebook && (is_string($facebook) && $facebook !== '')) {
            $this->og_tag('article:author', $facebook);
            return true;
        }
        return false;
    }

Usage Example

 /**
  * @covers WPSEO_OpenGraph::article_author_facebook
  */
 public function test_article_author_facebook()
 {
     // test not on singular page
     $this->assertFalse(self::$class_instance->article_author_facebook());
     // create post with author
     $author_id = $this->factory->user->create(array('role' => 'administrator'));
     $post_id = $this->factory->post->create(array('post_author' => $author_id));
     $this->go_to(get_permalink($post_id));
     // on post page but facebook meta not set.
     $this->assertFalse(self::$class_instance->article_author_facebook());
     // add facebook meta to post author
     $post = get_post($post_id);
     $author = $post->post_author;
     add_user_meta($author, 'facebook', 'facebook_author');
     // test final output
     $this->assertTrue(self::$class_instance->article_author_facebook());
     $this->expectOutput('<meta property="article:author" content="facebook_author" />' . "\n");
 }