julianS-28
Background of the issue:
I am trying to ensure that the Yoast Author Schema URLs on our author pages always display the current domain for the DE website. We have many author pages, and I have a scrape that shows the Yoast author page URLs via the Schema markup: hidden link .
Symptoms:
The Yoast Author Schema links are displayed with different URLs on the DE version, sometimes showing .DE, .AT, or .NL domains.
Questions:
Can you help me to display the URLs always in the current domain?
Shekhar Bhandari
WPML Supporter since 03/2015
Languages:
English (English )
Timezone:
Asia/Kathmandu (GMT+05:45)
Hello there,
I have escalated this issue to our 2nd tier supporter, I will update you further as soon as I will receive any feedback from them.
Thanks
Shekhar Bhandari
WPML Supporter since 03/2015
Languages:
English (English )
Timezone:
Asia/Kathmandu (GMT+05:45)
Hello there,
This is still on our 2nd tier queue, I will update you as soon as I will receive any further feedbacks.
Thanks
Shekhar Bhandari
WPML Supporter since 03/2015
Languages:
English (English )
Timezone:
Asia/Kathmandu (GMT+05:45)
Hello there,
Our 2nd tier suggested the following workaround, so can you try to add the following in theme functions.php file and see if it helps.
function modify_wpseo_schema_graph( $data ) {
if ( empty( $data ) || ! is_array( $data ) ) {
return $data;
}
foreach ( $data as &$schema_piece ) {
// Check if the schema type is ProfilePage
//if ( isset( $schema_piece['@type'] ) && $schema_piece['@type'] === 'ProfilePage' ) {
// Update the URL
if ( isset( $schema_piece['url'] ) ) {
$schema_piece['url'] = apply_filters( 'wpml_permalink', $schema_piece['url'] );
}
if ( isset( $schema_piece["@id"] ) ) {
$schema_piece["@id"] = apply_filters( 'wpml_permalink', $schema_piece["@id"] );
}
if ( isset( $schema_piece["primaryImageOfPage"]["@id"] ) ) {
$schema_piece["primaryImageOfPage"]["@id"] = apply_filters( 'wpml_permalink', $schema_piece["primaryImageOfPage"]["@id"] );
}
if ( isset( $schema_piece["image"]["@id"] ) ) {
$schema_piece["image"]["@id"] = apply_filters( 'wpml_permalink',$schema_piece["image"]["@id"] );
}
if ( isset( $schema_piece["breadcrumb"]["@id"] ) ) {
$schema_piece["breadcrumb"]["@id"] = apply_filters( 'wpml_permalink', $schema_piece["breadcrumb"]["@id"] );
}
if ( isset( $schema_piece["potentialAction"][0]["target"][0] ) ) {
$schema_piece["potentialAction"][0]["target"][0] = apply_filters( 'wpml_permalink', $schema_piece["potentialAction"][0]["target"][0] );
}
if ( isset( $schema_piece["mainEntityOfPage"]["@id"] ) ) {
$schema_piece["mainEntityOfPage"]["@id"] = apply_filters( 'wpml_permalink', $schema_piece["mainEntityOfPage"]["@id"] );
}
// }
}
return $data;
}
add_filter( 'wpseo_schema_graph', 'modify_wpseo_schema_graph', 10, 1 );
Look forward to your reply.
Thanks
julianS-28
Hi,
thanks for the snippet and sorry for the late reply. I missed the notification.
I just inserted the snippet, and I'm testing if everything is good now. I'll let you know soon.
Shekhar Bhandari
WPML Supporter since 03/2015
Languages:
English (English )
Timezone:
Asia/Kathmandu (GMT+05:45)
Sure, will wait for your feedback.