' . "\n";
}
$faq = json_decode( (string) get_post_meta( $id, '_howseen_faq', true ), true );
if ( ! is_array( $faq ) || count( $faq ) < 2 ) {
return;
}
$entities = array();
foreach ( $faq as $pair ) {
if ( is_array( $pair ) && isset( $pair['q'], $pair['a'] ) ) {
$entities[] = array(
'@type' => 'Question',
'name' => (string) $pair['q'],
'acceptedAnswer' => array(
'@type' => 'Answer',
'text' => (string) $pair['a'],
),
);
}
}
if ( count( $entities ) < 2 ) {
return;
}
$json = wp_json_encode(
array(
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => $entities,
),
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP
);
if ( $json ) {
echo '' . "\n"; // phpcs:ignore WordPress.Security.EscapeOutput -- JSON_HEX_TAG: no "<" can close the script.
}
}
/** Bing and Google ownership tags set by Howseen (site/verify), on every page: both engines read the home page. */
function howseen_verification_output() {
$tags = array(
'msvalidate.01' => (string) get_option( 'howseen_verify_bing', '' ),
'google-site-verification' => (string) get_option( 'howseen_verify_google', '' ),
);
foreach ( $tags as $name => $code ) {
if ( '' !== $code ) {
echo '' . "\n";
}
}
}