• Hi Guys, I hope somebody helps me.

    I recently Found Multiple Meta descriptions issues through the AHrefs site audit. theme is generating one meta description and my SEO plugin(SEOPress) is generating one meta description. Can you please help me with how to remove the theme meta description code from the website? I am not good at the technical stuff. It will be great if you help me. Thanks in advance.

    Here is the screenshot of the issues. https://prnt.sc/ze6Cko6kIYZo

    FUnction.php code

    /* Push google analytics code in head area */
    function qoxag_meta_des_viewport(){
        ?>
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <meta name="description" content="<?php if ( is_single() ) {
        single_post_title('', true); 
            } else {
            bloginfo('name'); echo " - "; bloginfo('description');
            }
            ?>" />
        <?php
    }
    add_action('wp_head', 'qoxag_meta_des_viewport', 1);

    Please tell me how to remove that meta description alone.

    • This topic was modified 2 years, 7 months ago by saranrock.

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • @saranrock If you feel comfortable modifying your theme, you could simply remove the meta code from your theme’s functions.php file so the only meta description is the one provided by SEOPress.

    The downside to this approach is any time you get a theme update, you’ll lose your custom code. Alternatively, if you want to keep the theme as-is, you could add the following code snippet in a custom plugin. What this does is it removes the action that was defined in the theme and then creates a new action where you can customize the HTML (so you have the viewport information included).

    
    // Remove the theme hook
    remove_action( 'wp_head', 'qoxag_meta_des_viewport', 1 );
    
    /* Push google analytics code in head area (modified) */
    function qoxag_meta_des_viewport_new(){
        ?>
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <?php
    }
    add_action('wp_head', 'qoxag_meta_des_viewport_new', 1);
    
    • This reply was modified 2 years, 7 months ago by Ben Greeley.
    Thread Starter saranrock

    (@saranrock)

    Thank you so much @bengreeley. I tried using the Code snippet plugin and it was perfectly working.

    I need one more favor, I have the same issues with one more website can you help me? Or the same code will work for all the sites

    Website link – Link

    Screenshot of the issue – https://prnt.sc/tMzq_RfMyc8W

    FUnction.php code

    /* disable option for font awesome icons from elementor editor */
    add_filter(‘elementor/icons_manager/native’, function ($icons) {
    $fontawesome = true;
    if ($fontawesome == true) {
    unset($icons[‘fa-regular’]);
    unset($icons[‘fa-solid’]);
    unset($icons[‘fa-brands’]);
    }

    return $icons;
    });

    //meta description
    function vinkmag_meta_des_viewport()
    {
    ?>
    <meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=5″>
    <?php if(!get_post_meta(get_the_ID(), ‘_yoast_wpseo_metadesc’, true) || !class_exists(‘Yoast_Form’)): ?>
    <meta name=”description” content=”<?php if (is_single()) {
    single_post_title(”, true);
    } else {
    bloginfo(‘name’);
    echo ” – “;
    bloginfo(‘description’);
    }
    ?>”/>
    <?php
    endif;
    }

    add_action(‘wp_head’, ‘vinkmag_meta_des_viewport’, 1);

    // content security policy(CSP)
    header(“Content-Security-Policy: script-src ‘self’ ‘unsafe-inline’ ‘unsafe-eval’ https: data:”);`

    • This reply was modified 2 years, 7 months ago by saranrock.

    @saranrock Yes, you should be able to do something similar, but instead of remove_action( 'wp_head', 'qoxag_meta_des_viewport', 1 ); you’d use remove_action( 'wp_head', 'vinkmag_meta_des_viewport', 1 ); and then use the rest of the code from vinkmag_meta_des_viewport in your new function so it’s customized for that site.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to remove theme generated Meta description from the website’ is closed to new replies.