Hello
Im pulling some Yoast SEO meta from a repeater field – if it exists. The problem is that Yoast calls the filter twice (adds the meta two places) and break does not reset the while loop. So adding this to my functions.php
function wpseo_custom_description( $title ) {
if(empty($title)) {
while(has_sub_field("content_type")) {
if(get_row_layout() == "text") {
$title = get_sub_field('text');
$title = getplaintextintrofromhtml($title, 156);
break;
}
}
}
return $title;
}
// This filter gets called twice
add_filter( 'wpseo_metadesc', 'wpseo_custom_description');
Returns the first “text” field and the the “second” text field. And what i would like is to get the “first” text field returned twice.
Can someone help me to reset the data in the while loop?
Thanks a lot!
Add reset_rows(); after the while loop