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()