How can I add post content in meta description via Title & Metas
?
I have seen excerpt variable %%excerpt%%
but it will give only excerpt but I want whole content in meta description.
Can any one help me for this because I can not found variable for content?
Thankns
2 Answers
Here is a safe and Yoast preferred method
add_action('wp_head','add_custom_meta_description_box');
function retrieve_var1_replacement( $var1 ) {
global $post;
return strip_tags($post->post_content);
}
function register_my_plugin_extra_replacements() {
wpseo_register_var_replacement( '%%mycustomdesc%%', 'retrieve_var1_replacement', 'advanced', 'this is a help text for myvar1' );
}
add_action( 'wpseo_register_extra_replacements', 'register_my_plugin_extra_replacements' );
You can now replace your %%excerpt%% with %%mycustomdesc%%