Support » Theme: Twenty Seventeen » Can’t remove twentyseventeen_include_svg_icons action in child theme

  • I am working with a child theme for twenty-seventeen, and I can’t remove the action in the parent theme to embed the svg icons.

    It’s called in the /themes/twentyseventeen/inc/icon-functions.php file:

    function twentyseventeen_include_svg_icons() {
    	// Define SVG sprite file.
    	$svg_icons = get_parent_theme_file_path( '/assets/images/svg-icons.svg' );
    
    	// If it exists, include it.
    	if ( file_exists( $svg_icons ) ) {
    		require_once( $svg_icons );
    	}
    }
    add_action( 'wp_footer', 'twentyseventeen_include_svg_icons', 9999 );

    I tried to remove the hook in my child theme functions file:

    remove_action( 'wp_footer', 'twentyseventeen_include_svg_icons', 99999);

    But the path definitions are still embedded in the footer. The only way I was able to remove them was to comment out the function in the include file in the parent theme (identified above).

    What’s going on there? I noticed another report on this issue before, can anyone advise?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You can try this.

    function blank_fuction_theme_svg_icons () {
    // your code goes here
    }
    function theme_svg_icons_remove () {
    remove_action( ‘wp_footer’, ‘twentyseventeen_include_svg_icons’, 9999 );
    add_action( ‘wp_footer’, ‘blank_fuction_theme_svg_icons’, 10000 );
    }
    add_action( ‘after_setup_theme’, ‘theme_svg_icons_remove’ );

    Nope, @taslimbd, no luck. Bizarre….

    Hi @bobsd99 it’s working one of my site.

    Strange, I must have somehow interfered with the mechanics of the hook.

    Columbus

    (@christof15)

    Put this in your child theme’s functions.php

    
    // START Disable 2017 SVG Icons
    function remove_parent_svg_icons()
        {
            remove_action('wp_footer', 'twentyseventeen_include_svg_icons', 9999);
        }
    add_action('after_setup_theme', 'remove_parent_svg_icons');
    // END Disable 2017 SVG Icons
    
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can’t remove twentyseventeen_include_svg_icons action in child theme’ is closed to new replies.