Hello,
Divi is a paid theme right? I need to see the source code of Divi in order to remove the generator tag and I don’t have that theme with me. If I get access to that theme in future, I will check its code and then try working on the generator removal.
Thanks & Regards,
Pankaj
Thread Starter
4ud
(@4ud)
Hi Pankaj,
I can send you my own Divi-Theme privatly. Would that be ok for you?
Best regards!
Thread Starter
4ud
(@4ud)
..I have send it to you E-Mail address. TIA!
Got it. Let me check the source code. I will update you here.
Hi,
Released version 11.0 of the plugin with Divi theme meta generator removal feature. By default it is not enabled. Please enable the corresponding checkbox from Settings and let me know if this works.
Thanks & Regards,
Pankaj
Here’s the code to drop in your child theme functions.php. Tested on Divi 4.9.
// Remove Divi Generator
add_action( 'after_setup_theme', 'ezific_et_setup_theme', 11 );
function ezific_et_setup_theme(){
remove_action( 'wp_head', 'head_addons', 7 );
add_action( 'wp_head', 'ezific_divi_head_addons', 9 );
}
function ezific_divi_head_addons(){
global $shortname, $default_colorscheme;
// phpcs:disable WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
$color_scheme = apply_filters( 'et_get_additional_color_scheme', et_get_option( $shortname.'_color_scheme' ) );
if ( !empty( $color_scheme ) && $color_scheme !== $default_colorscheme ) { ?>
<link rel="stylesheet" href="<?php echo esc_url( get_template_directory_uri() . '/style-' . et_get_option( $shortname.'_color_scheme' ) . '.css' ); ?>" type="text/css" media="screen" />
<?php }
$child_cssurl = et_get_option( $shortname.'_child_cssurl' );
if ( et_get_option( $shortname.'_child_css' ) === 'on' && ! empty( $child_cssurl ) ) { //Enable child stylesheet ?>
<link rel="stylesheet" href="<?php echo esc_url( $child_cssurl ); ?>" type="text/css" media="screen" />
<?php }
// SECTION COMMENTED OUT - this removes the generator tag
//prints the theme name, version in meta tag
// $theme_info = wp_get_theme();
// echo '<meta content="' . esc_attr( $theme_info->display( 'Name' ) . ' v.' . $theme_info->display( 'Version' ) ) . '" name="generator"/>';
if ( et_get_option( $shortname . '_custom_colors' ) === 'on' ) et_epanel_custom_colors_css();
// phpcs:enable
}// end function head_addons()
The plugin already removes the Divi meta generator. No need to use any additional code anywhere else. Just use version 11 of the plugin.
Oh, sorry I didn’t see I was on a plugin-specific topic here. Saw the post title, posted the solution without the need for any plugins.
This plugin is probably an easier solution than mine.