Skip to content

Instantly share code, notes, and snippets.

@sunriseweb
Created January 23, 2015 22:22
Show Gist options
  • Save sunriseweb/91f1af9cc81c4b2ee6c3 to your computer and use it in GitHub Desktop.
Save sunriseweb/91f1af9cc81c4b2ee6c3 to your computer and use it in GitHub Desktop.
Makes Divi Pagebuilder work with Yoast SEO
//Enable shortcodes in WordPress SEO generated Meta Description with HTML removed
add_filter( 'wpseo_metadesc', 'am_enable_shortcodes_removed_html' ); //see https://yoast.com/wordpress/plugins/seo/api/
function am_enable_shortcodes_removed_html($metadesc) {
if( strpos($metadesc, 'et_pb_section') !== FALSE ) {
global $post;
$rendered_content = apply_filters('the_content', $post->post_content);
$newmetadesc = strip_tags( $rendered_content );
return substr($newmetadesc, 0, 156);
} else {
return $metadesc;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment