Custom field with variable in Video schema Content URL

#257448
  • Resolved Mara Sec
    Rank Math free

    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?

Viewing 16 replies (of 16 total)
  • Hello,

    Please don’t remove it as you still need it for your schema structure and with the contentUrl empty, you can’t generate og:video meta tags.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 16 replies (of 16 total)

The ticket ‘Custom field with variable in Video schema Content URL’ is closed to new replies.