Title: removing function from unknown hook
Last modified: January 21, 2018

---

# removing function from unknown hook

 *  [fschaar](https://wordpress.org/support/users/fschaar/)
 * (@fschaar)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/removing-function-from-unknown-hook/)
 * I have a question regarding a theme development issue. I’m trying to develop 
   a child theme deprived from One Page Express Theme (`https://onepageexpress.com`).
   
   It’s working fine so far, but now I want to replace a function in function.php.
   As far as I have understood it, I have to remove it from an action or filter (
   is there a difference in this case?) to create a rewritten function. Otherwise
   the site gets broken. The problem is: I do not know the $tag string I i have 
   to specify in the remove_action() function. I do not see where the original function
   was added by add_filter() or add_action(). Anyone an idea how to accomplish that?
 * The function is under inc/function.php in the theme folder line 2369.
 * Here is a listig of the code:
 *     ```
       function one_page_express_background($inner = false)
       {
           $attrs = array(
               'class' => $inner ? "header " : "header-homepage ",
           );
   
           $prefix = $inner ? "one_page_express_inner_header" : "one_page_express_header";
           $bgType = get_theme_mod($prefix . '_background_type', 'image');
   
           $header_type  = $inner ? "inner_header" : "header";
           $show_overlay = get_theme_mod("one_page_express_" . $header_type . "_show_overlay", true);
           if ($show_overlay) {
               $attrs['class'] .= " color-overlay ";
           }
   
           switch ($bgType) {
   
               case 'image':
                   $bgImage        = $inner ? get_header_image() : get_theme_mod($prefix . '_image', get_template_directory_uri() . "/assets/images/home_page_header.jpg");
                   $attrs['style'] = 'background-image:url("' . esc_url($bgImage) . '")';
                   $parallax       = get_theme_mod("one_page_express_" . $header_type . "_parallax", true);
                   if ($parallax) {
                       $attrs['data-parallax-depth'] = "20";
                   }
                   break;
   
               case 'gradient':
   
                  $bgGradient     = get_theme_mod($prefix . "_gradient", "plum_plate");
                   $attrs['class'] .= $bgGradient;
                   break;
   
               case 'slideshow':
   
                   $js = get_template_directory_uri() . "/assets/js/libs/jquery.backstretch.js";
                   wp_enqueue_script('one-page-express-backstretch', $js, array('jquery'), false, true);
                   add_action('wp_footer', $prefix . '_slideshow_script');
   
                   break;
   
               case 'video':
                   $internalVideo = get_theme_mod($prefix . '_video', "");
                   $video_url     = get_theme_mod($prefix . '_video_external', "https://www.youtube.com/watch?v=3iXYciBTQ0c");
                   $videoPoster   = get_theme_mod($prefix . '_video_poster', get_template_directory_uri() . "/assets/images/Mock-up.jpg");
   
                   if ($internalVideo) {
                       $video_url = wp_get_attachment_url($internalVideo);
                       $video_url = apply_filters('get_header_video_url', $video_url);
                   }
   
                   $video_type = wp_check_filetype($video_url, wp_get_mime_types());
                   $header     = get_custom_header();
                   $settings   = array(
                       'mimeType'  => '',
                       'videoUrl'  => $video_url,
                       'posterUrl' => $videoPoster,
                       'width'     => absint($header->width),
                       'height'    => absint($header->height),
                       'minWidth'  => 900,
                       'minHeight' => 500,
                       'l10n'      => array(
                           'pause'      => __('Pause', 'one-page-express'),
                           'play'       => __('Play', 'one-page-express'),
                           'pauseSpeak' => __('Video is paused.', 'one-page-express'),
                           'playSpeak'  => __('Video is playing.', 'one-page-express'),
                       ),
                   );
   
                   if (preg_match('#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video_url)) {
                       $settings['mimeType'] = 'video/x-youtube';
                   } else if ( ! empty($video_type['type'])) {
                       $settings['mimeType'] = $video_type['type'];
                   }
   
                   $settings = apply_filters('header_video_settings', $settings);
   
                   wp_enqueue_script('wp-custom-header');
                   wp_localize_script('wp-custom-header', '_wpCustomHeaderSettings', $settings);
                   wp_enqueue_script('cp-video-bg', get_template_directory_uri() . "/assets/js/video-bg.js", array('wp-custom-header'));
                   $attrs['class'] .= " cp-video-bg";
                   break;
           }
   
           $result = "";
   
           if ( ! isset($attrs['style'])) {
               $attrs['style'] = "";
           } else {
               $attrs['style'] .= ";";
           }
   
           if ( ! $inner) {
               $attrs['style'] .= " min-height:" . one_page_express_header_height();
           }
   
           $attrs = apply_filters('one_page_express_header_background_atts', $attrs, $bgType, $inner);
   
           foreach ($attrs as $key => $value) {
               $value  = trim(esc_attr($value));
               $result .= " {$key}='{$value}'";
           }
   
           return $result;
       }
   
       function one_page_express_header_slideshow_script()
       {
           one_page_express_header_slideshow_script_();
       }
       ```
   
    -  This topic was modified 8 years, 3 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).
    -  This topic was modified 8 years, 3 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).
    -  This topic was modified 8 years, 3 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).

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

 *  [Rajan Vijayan](https://wordpress.org/support/users/rajanit2000/)
 * (@rajanit2000)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/removing-function-from-unknown-hook/#post-9885544)
 * Hi [@fschaar](https://wordpress.org/support/users/fschaar/).,
 * So you need to remove_action from your parent theme and overwrite with your child
   theme right?
 * [https://codex.wordpress.org/Function_Reference/remove_action](https://codex.wordpress.org/Function_Reference/remove_action)
 * $tag is the name of the hook.
 * for example, if you don’t want wp_footer hook
 *     ```
       add_action( 'wp_head', 'remove_my_action' );
       function remove_my_action(){
       	remove_action( 'wp_footer', 'function_being_removed' );
       }
       ```
   
 * Thanks
    Rajan V
 *  Thread Starter [fschaar](https://wordpress.org/support/users/fschaar/)
 * (@fschaar)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/removing-function-from-unknown-hook/#post-9885562)
 * That is the Problem, I do not know the name of the hook. Howdy I find out? I 
   do not see an add_action with that function.
 *  Thread Starter [fschaar](https://wordpress.org/support/users/fschaar/)
 * (@fschaar)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/removing-function-from-unknown-hook/#post-9886111)
 * As far as I can see “one_page_express_background” is not added to any filter 
   or action hook. but when i try to create an empty function wit the same name 
   in in the child theme, the site gets broke.

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

The topic ‘removing function from unknown hook’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [fschaar](https://wordpress.org/support/users/fschaar/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/removing-function-from-unknown-hook/#post-9886111)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
