Description filter does not apply
-
Hello guys,
before my vacation 3 weeks ago, we had (and still have) the following script in place to get an excerpt from our review cpt description field for the meta description.
`add_filter( ‘the_seo_framework_generated_description’, function($description, $args){
if ($args === null && get_post_type( get_the_ID() ) == ‘product_reviews’){
$product = get_field(‘name’, get_the_ID());
$beschreibung = get_field(‘beschreibung’, get_the_ID());if (is_tax()){
$catTitleRaw = get_the_archive_title();
$newCatTitle = get_string_between($catTitleRaw, ‘<span>’, ‘</span>’);
$description = ‘Lie? dir ‘.$newCatTitle.’ echter Nutzer durch, um die richtige Tool Entscheidung für dein Unternehmen zu treffen!’;
} else {
if(strlen($beschreibung) == 0){
$description = “Du interessierst dich für ” . $product . “? Auf OMKB Reviews 2022 erf?hrst du, was andere Nutzer von ” . $product . ” halten.”;
} else {
$description_ohne_html = substr(strip_tags($beschreibung), 0, 145);
$letztesLeerzeichen = strrpos($description_ohne_html, ” “);
$description = substr($description_ohne_html, 0, $letztesLeerzeichen);
}
}return $description;
}
}, 10, 2);BUT in the middle of last week I noticed the descriptions are no longer build even though we did not change anything.
After desperately trying to fix the problem myself, I came to the forum in hope one of you can tell me what is going on.
$description is filled with the correct excerpt in it, but the content of the variable never reaches the meta description which always results empty.
We have the same issue in other custom post types as well, but only with the meta descriptions, not the title tags which are build with a filter as well.
I am looking forward to your replys!
Regards
Thomas
- The topic ‘Description filter does not apply’ is closed to new replies.