I'm coding a plugin that allows me to dynamically insert content for my meta description and title. The content is already being pulled fine, the only part I can't get to work is actually filtering the meta description.
I was able to get the title working like this:
add_filter( 'wp_title', 'filter_wp_title');
function filter_wp_title( $title ){
$title = wpg_modules($title);
return( $title );
}
where wpg_modules() returns the content to use for the title. But I can't find an equivalent way to do this for the meta description, presumably because WP doesn't just always have one unless your theme or another plugin does.
Please note the above code works perfectly and is not what I need help with, I merely provided it as an example of filtering the title that works fine.
So, how can I filter an existing meta description, if present?