You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a website with some post that have duplicate meta tags with similar keys. Strange and unwanted, but it was there.
It may be useful for someone so here's my quick-fix:
publicstaticfunctionlinkRewriteFieldsExtract($post, $fieldName) {
$postMeta = get_post_meta($post->ID);
if(!isset($postMeta[$fieldName]))
return'';
//deal with duplicate keys by taking the value of the firstif (is_array($postMeta[$fieldName])) {
$value = $postMeta[$fieldName][0];
} else {
$value = implode('', $postMeta[$fieldName]);
}
$value = sanitize_title($value);
return$value;
}
The text was updated successfully, but these errors were encountered:
Thank you for the contribution. Indeed, it is an another case I didn’t considered. Soon I will review code and make some tests and release a new version.
Great plugin. Slick and functional.
I had a website with some post that have duplicate meta tags with similar keys. Strange and unwanted, but it was there.
It may be useful for someone so here's my quick-fix:
The text was updated successfully, but these errors were encountered: