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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.