Advanced Custom Fields and Yoast SEO keyword analysis [closed]

Looking at the filter:

$post_content = apply_filters( 'wpseo_pre_analysis_post_content', $post->post_content, $post );

it would be a matter of adding your fields content to string being analyzed.

You have to do the get_field() part right, this is untested:

add_filter( 'wpseo_pre_analysis_post_content', 'filter_yoasts_wpse_119879', 10, 2 );

function filter_yoasts_wpse_119879( $content, $post )
{
    $fields = get_field( 'name', $post->ID );
    return $content . $fields;
}

As noted by kaiser in comments, the get_field() function is not reliable. If it is a relatively simple field, it’s better to stick to get_post_meta.

Related: Where do I put the code snippets I found here or somewhere else on the web?

Leave a Comment