Home Forums Add-ons Flexible Content Field Yoast SEO & ACF Reply To: Yoast SEO & ACF

  • hey paul. i took a look into the code of yoast. seems it expects < img > strings in $content. so all you need to do is something like this:

    add_filter( 'wpseo_pre_analysis_post_content', 'filter_yoasts_wpse_119879', 10, 2 );
    function filter_yoasts_wpse_119879( $content, $post ){
    	$myimage = get_field("myimage",$post->ID);
    	$content .= "<img src='".$myimage["sizes"]["medium"]."' alt='".$myimage["alt"]."'/>";
    	return $content;

    and it would recognize your custom field images.