This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //* do not include php tag | |
add_filter('schema_output', 'schema_wp_extend_output_articleBody_98738765'); | |
/** | |
* Add articleBody to Schema Output | |
* | |
* @since 1.0 | |
*/ | |
function schema_wp_extend_output_articleBody_98738765( $schema ) { | |
global $post; | |
if ( empty($schema) ) return; | |
// Add articleBody | |
// $schema['articleBody'] = 'This is the article body text...'; | |
// | |
// So, you can do something like this to pull value from post meta | |
// | |
// Change YOUR-KEY with the actual post meta key where value is stored | |
// | |
$article_body = get_post_meta( $post->ID, 'YOUR-KEY', true ); | |
if ( isset($article_body) ) { | |
$schema['articleBody'] = $article_body; | |
} | |
return $schema; | |
} |