📅  最后修改于: 2022-03-11 14:54:18.896000             🧑  作者: Mango
function header_override () {
// $template = locate_template('header.php');
// load_template(plugin_dir_path( __FILE__ ) . 'templates/header.php');
// print_r($template);
if ( $overridden_template = locate_template( 'header.php' ) ) {
load_template( $overridden_template );
}else{
load_template(plugin_dir_path( __FILE__ ) . 'templates/header.php');
}
}
add_action('template_include', 'header_override');
function new_header_output() {
remove_action( 'get_header', 'header_output', 20);
load_template(plugin_dir_path( __FILE__ ) . 'templates/header.php');
}
add_action('get_header', 'new_header_output');
function action_function_name_391( $name, $args ){
print_r("custom header");
}
add_action( 'get_header', 'action_function_name_391', 10, 2 );