-
Hi I refer to another ticket: https://support.rankmath.com/ticket/rankmath-video-url-dl-automatic-in-content-url/
I’ve added the relevant code in my functions.php and reference it with %wps_trailer_url% in Content Url, unfortunately when the actual page is rendered, it shows as:
<meta property="og:video" content="%wps_trailer_url%" />
add_action( 'rank_math/vars/register_extra_replacements', function() {
rank_math_register_var_replacement(
'wps_trailer_url', [
'name' => esc_html__( 'Author name', 'rank-math' ),
'description' => esc_html__( 'Author description', 'rank-math' ),
'variable' => 'wps_trailer_url',
'example' => rankmath_add_trailer_url(),
],
'rankmath_add_trailer_url'
);
});
function rankmath_add_trailer_url(){
global $post;
return get_post_meta( $post->ID, 'trailer_url', true );
}
Am I missing something?
The ticket ‘Custom field with variable in Video schema Content URL’ is closed to new replies.