• Resolved Ruslan

    (@devprollc)


    I need to write PHP function that copy og:title from the page’s title, og:description from page’s description. How to do that?

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

    (@maybellyne)

    Hello @devprollc

    Thanks for reaching out about your Open Graph tags. We have snippet variables that can work instead of custom code. You could use %%title%% in the Facebook title field, and the title of the page will be fetched.

    Also, %%excerpt%% in the Facebook description field will pull the post/page excerpt (or auto-generated if it does not exist).

    I hope that helps!

    • This reply was modified 1 year, 1 month ago by Maybellyne.
    Thread Starter Ruslan

    (@devprollc)

    I added this code, but it not works:

    //Yoast SEO – set og:title as the title of the page
    add_filter( ‘wpseo_opengraph_title’, ‘get_the_title’, PHP_INT_MAX );

    //Yoast SEO – set og:description as the description of the page
    add_filter( ‘wpseo_opengraph_description’, ‘get_the_title’, PHP_INT_MAX );

    Why is not working?

    Plugin Support Maybellyne

    (@maybellyne)

    Sorry, I can’t review your code. Please speak with a web developer.

    Plugin Support Jose Varghese

    (@josevarghese)

    This thread was marked resolved due to a lack of activity, but you’re always welcome to re-open the topic. Please read this post before opening a new request.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to copy og:title from title, og:description from description?’ is closed to new replies.