skip to Main Content

I’m currently using the Zox News theme along with the premium version of SEOpress. I’ve encountered an issue where the Zox News theme is generating duplicate meta information, including Twitter, Facebook, Open Graph (OG) description, and OG title. I would like to completely remove the Open Graph meta. Your assistance with this matter would be greatly appreciated. Thank you.

I found a scource code but not sure what to delete it It would be great if someone helps me.. I have a child theme please provide a necessary code which i can add it to function.php file, so the next time when i update theme it won’t get deleted. Here is the theme code

<head>
<meta charset="<?php bloginfo('charset'); ?>" >
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=1.0, user-scalable=yes" />
<?php if ( ! function_exists( 'has_site_icon' ) || ! has_site_icon() ) { if(get_option('mvp_favicon')) { ?><link rel="shortcut icon" href="<?php echo esc_url(get_option('mvp_favicon')); ?>" /><?php } } ?>
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php if ( is_single() ) { ?>
<meta property="og:type" content="article" />
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
        <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'mvp-post-thumb' ); ?>
        <meta property="og:image" content="<?php echo esc_url( $thumb['0'] ); ?>" />
        <meta name="twitter:image" content="<?php echo esc_url( $thumb['0'] ); ?>" />
    <?php } ?>
<meta property="og:url" content="<?php the_permalink() ?>" />
<meta property="og:title" content="<?php the_title_attribute(); ?>" />
<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt()); ?>" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" content="<?php the_permalink() ?>">
<meta name="twitter:title" content="<?php the_title_attribute(); ?>">
<meta name="twitter:description" content="<?php echo strip_tags(get_the_excerpt()); ?>">
<?php endwhile; endif; ?>
<?php } else { ?>
<meta property="og:description" content="<?php bloginfo('description'); ?>" />
<?php } ?>
<?php wp_head(); ?>
</head>

2

Answers


  1. Chosen as BEST ANSWER

    thank you for the reply. However, when I remove that code from the header file, it shows an error stating, 'The website has encountered a critical error


  2. Here is a list of code that clearly shows integration of Open Graph tags:

    <meta property="og:url" content="<?php the_permalink() ?>" />
    <meta property="og:title" content="<?php the_title_attribute(); ?>" />
    <meta property="og:description" content="<?php echo strip_tags(get_the_excerpt()); ?>" />
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:url" content="<?php the_permalink() ?>">
    <meta name="twitter:title" content="<?php the_title_attribute(); ?>">
    <meta name="twitter:description" content="<?php echo strip_tags(get_the_excerpt()); ?>">
    <?php endwhile; endif; ?>
    <?php } else { ?>
    <meta property="og:description" content="<?php bloginfo('description'); ?>" />
    <?php } ?>
    

    Just remove them and test using view-source.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search