Support » Plugin: OG » How to change OG:title of a single post

  • Resolved andreasleas

    (@andreasleas)


    Hey guys,

    I did not find the answer I needed in the FAQs so please help me out.
    I would like to change a title of a single post, not the entire website.
    So below the post editor, there is no field for changing the OG:Title Tag.

    How can I change OG:Title tag for a single post? Is there any easy way like a field to insert the new title like its done with the post image or so? If not, please explain step by step how to enter and generate new og:title. Thank you very much.

    Andreas

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Marcin Pietrzak

    (@iworks)

    Hi @andreasleas,

    You can use this snippet to change single post og:title for the post with ID 10:

    
    add_filter( 'og_og_title_value', 'my_custom_title_for_og_plugin' );
    function my_custom_title_for_og_plugin( $value ) {
        if ( is_single( 10 ) ) {
            return 'my custom og title';
        }
        return $value;
    }
    

    OG plugin does not have another ability to manipulate OG values – the purpose of this plugin was to have zero configuration.

    Marcin

    Hello, where do I insert this snippet exactly?
    Thank you very much

    • This reply was modified 1 year, 3 months ago by  andreasleas.

    Hello I inserted snippet please explain what do you mean by changing OG.title with ID 10 thank you

    Plugin Author Marcin Pietrzak

    (@iworks)

    Hi @andreasleas

    This 10 is a post Id it is unique for every entry. It is only an example.

    Marcin

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to change OG:title of a single post’ is closed to new replies.