• Resolved skittery

    (@skittery)


    I have a simple shortcode which I use on post titles:

    add_shortcode(‘year’, ‘year_shortcode’);
    function year_shortcode() {
    $year = date(‘Y’);
    return $year;
    }

    add_filter( ‘single_post_title’, ‘my_shortcode_title’ );
    add_filter( ‘the_title’, ‘my_shortcode_title’ );
    add_filter(‘wpseo_title’, ‘my_shortcode_title’);
    add_filter( ‘wpseo_metadesc’, ‘my_shortcode_title’ );

    function my_shortcode_title( $title ){
    return do_shortcode( $title );
    }
    It works fine but I suddenly realized that Yoast creates an og:title and it doesn’t render there (meaning it doesn’t render on Facebook or whatsapp)

    I searched for an answer and couldn’t find anythinng. Has anyone faced this before?

    Maybe I need to run the og:title through a filter of some sort which is also fine, the question is how.

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello @skittery

    If I understand correctly, you want to use shortcodes in Open Graph tags. Thank you for suggesting a new feature for one of our plugins! You’re not the first to have requested this feature!

    What’s next?
    Our product team will assess the feature request and assign a priority level to the report. Our developers work on the highest priority issues first. We cannot give you an estimate of when or if they’ll start working on the request.

    If you have any further information that may affect the prioritization, please leave a comment or subscribe to the GitHub report to get updates on the issue.

    https://github.com/Yoast/wordpress-seo/issues/18037`

    Thread Starter skittery

    (@skittery)

    Hi, thanks for the reply.
    Just to clarify – I use the shortcode on the Yoast meta title and the open graph pulls the data from there (or the post title).
    On the meta title it appears correctly and on the open graph it does not.

    I think it just needs to have the same filters as already exist on the meta title.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcode not rendering in og:title’ is closed to new replies.