• Resolved Unreal NFS

    (@unrealnfs)


    Hi,

    I want to remove these 2 generator meta informations from displaying in the frontend for security reasons.

    generator – WP Super Duper v1.2.18
    generator – WP Font Awesome Settings v1.1.7

    <meta name="generator" content="WP Super Duper v1.2.18" data-sd-source="geodirectory" />
    <meta name="generator" content="WP Font Awesome Settings v1.1.7" data-ac-source="geodirectory" />

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • 1naveengiri

    (@1naveengiri)

    Hi @unrealnfs,

    Please try this code snippet.

    /**
    * Remove unnecessary generator tags from wp_head
    */
    function geobuddy_remove_generator_tags() {
    // Check if the classes exist before attempting to remove actions
    if ( class_exists( 'WP_Font_Awesome_Settings' ) ) {
    $fa_instance = WP_Font_Awesome_Settings::instance();
    remove_action( 'wp_head', array( $fa_instance, 'add_generator' ), 99 );
    }

    if ( class_exists( 'WP_Super_Duper' ) ) {
    global $wp_super_duper;
    if ( $wp_super_duper instanceof WP_Super_Duper ) {
    remove_action( 'wp_head', array( $wp_super_duper, 'generator' ), 99 );
    }
    }
    }
    add_action( 'init', 'geobuddy_remove_generator_tags', 20 );

    Regards

    Thread Starter Unreal NFS

    (@unrealnfs)

    Hi @1naveengiri

    I have watched your YouTube Tutorials and i liked them all. Glad to see you here in the support.

    I tried the above PHP code-snippet – i used WPcode plugin.

    One part worked, other one didn’t.

    This below one did not work and its still shows in the frontend.

    <meta name="generator" content="WP Super Duper v1.2.18" data-sd-source="geodirectory" />

    Thanks.

    1naveengiri

    (@1naveengiri)

    Hi @unrealnfs,

    Thanks for your kind words.

    Try this updated code snippet, let me know how it goes.

    /**
    * Remove unnecessary generator tags from wp_head
    */
    function geobuddy_remove_generator_tags() {
    // Check if the classes exist before attempting to remove actions
    if ( class_exists( 'WP_Font_Awesome_Settings' ) ) {
    $fa_instance = WP_Font_Awesome_Settings::instance();
    remove_action( 'wp_head', array( $fa_instance, 'add_generator' ), 99 );
    }
    }
    add_action( 'init', 'geobuddy_remove_generator_tags', 20 );

    function remove_super_duper_generator_via_widget_init( $options, $instance ) {
    remove_action( 'wp_head', array( $instance, 'generator' ), 99 );
    }
    add_action( 'wp_super_duper_widget_init', 'remove_super_duper_generator_via_widget_init', 10, 2 );

    Regards

    Thread Starter Unreal NFS

    (@unrealnfs)

    That’s Fabulous – It Works!

    God bless.

    Have a great day.

    1naveengiri

    (@1naveengiri)

    have a good day 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘How to Hide “Generator” meta tags?’ is closed to new replies.