How can I get the meta description to show in the head of the page?

7.11K viewsGeneral
1

Can anyone help me here? How can I get the excerpt of a question to show as the meta description in the page head?

1

With recent changes to Add Meta Tags, it is now completely possible to make it work good with AnsPress. I’m using it, see it in action here: http://dima.stefantsov.com/qa/

add_action('wp', 'd_anspress_amt_fix');
function d_anspress_amt_fix()
{
    // Only make changes when inside AnsPress.
    if (!function_exists('is_anspress') || !is_anspress()) {
        return;
    }


    add_filter('amt_exclude_schemaorg_metadata', '__return_true');
    add_filter('amt_exclude_dublin_core_metadata', '__return_true');

    // Feed AMT with real question-post.
    if (is_question()) {
        add_filter('amt_get_queried_object', function(){ return get_post(get_question_id(), OBJECT); });
    }
}
You are viewing 1 out of 3 answers, click here to view all answers.