Skip to content

Instantly share code, notes, and snippets.

@hisnipes
Last active July 22, 2017 07:17
Show Gist options
  • Save hisnipes/7476902 to your computer and use it in GitHub Desktop.
Save hisnipes/7476902 to your computer and use it in GitHub Desktop.
The correct way to override a Wordpress parent theme function in functions.php through a child theme.
<?php
#-----------------------------------------------------------------#
# Example: load revised tinymce file in child theme folder
#-----------------------------------------------------------------#
add_action( 'after_setup_theme', 'new_function_setup' );
function new_function_setup() {
remove_action('init', 'old_function_init');
function new_function_init() {
if(is_admin()){
if(is_edit_page()){
require_once ( 'child_theme_folder/new_file.php' );
}
}
}
add_action('init', 'new_function_init');
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment