Created
January 23, 2015 22:22
-
-
Save sunriseweb/91f1af9cc81c4b2ee6c3 to your computer and use it in GitHub Desktop.
Makes Divi Pagebuilder work with Yoast SEO
This file contains hidden or 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
//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