• Resolved hackworth

    (@hackworth)


    How can I remove the following tags from all pages?

    <meta property=”article:published_time” content=”2021-06-07T20:08:01Z” />
    <meta property=”article:modified_time” content=”2021-06-24T20:24:00Z” />

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

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

    (@wpsmort)

    Hi @hackworth, you can remove them using the filter code below:

    
    `add_filter( 'aioseo_facebook_tags', 'aioseo_filter_facebook_article_tags' );
    
    function aioseo_filter_facebook_article_tags( $facebookMeta ) {
       if ( is_singular() ) {
          $facebookMeta['article:published_time'] = '';
          $facebookMeta['article:modified_time']  = '';
       }
       return $facebookMeta;
    }
    

    Place this in the functions.php file of your child theme or use the Code Snippets plugin if you don’t have a child theme.

    Thread Starter hackworth

    (@hackworth)

    Thanks … I’ve added via Code Snippets and got this error:

    Don't Panic
    The code snippet you are trying to save produced a fatal error on line 5:
    
    syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
    The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.
    
    Please use the back button in your browser to return to the previous page and try to fix the code error. If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.
    Plugin Support Steve M

    (@wpsmort)

    @hackworth There shouldn’t be an apostrophe before add_filter.

    Thread Starter hackworth

    (@hackworth)

    Yes, of course. I wondered about that but I’m not much of a coder so I dismissed it.

    All good now. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove published_time, modified_time meta properties’ is closed to new replies.