在深入研究了一些核心文件之后,我实际上能够解决这个问题。
以下函数将检索customizer中所有已注册的部分,并循环每个部分以完全取消注册它们。
这应该在注册您自己的任何自定义节之前运行,以免删除您的自定义注册节。
function eherman_remove_registered_customizer_sections() {
// retrieve the sections array
$registered_sections = $wp_customize->sections();
// loop over and remove each section
foreach( $registered_sections as $section ) {
$wp_customize->remove_section( $section->id );
}
}
一点也不坏。希望这对其他人有所帮助,因为我们离一个更强大的定制者越来越近了!
Resources: