1

For removing settings, controls and sections of the customizer, we can just simply use the remove methods like this:

function remove_custom($wp_customize) {
  $wp_customize->remove_setting('id');
  $wp_customize->remove_control('id');
  $wp_customize->remove_section('id');
}

What I notice is that there's no way to remove parent-theme customization, so non native customization of Wordpress itself. In fact, trying to remove the blogdescription is possible.

I can't find documentation about that. What am I ignoring?

1 Answer 1

2

I am guessing a lot about how your themes work but, the child theme's functions.php runs before the parent theme's functions.php, so anything loaded by the parent's functions isn't going to be present for you to remove. You need to hook your function so that it runs later.

add_action('after_setup_theme', 'remove_custom');

Though you would need to mess about with the $wp_customize variable. It would be easier to hook into the customize_register hook with a high priority number so that your code runs after the parent registration code.

add_action( 'customize_register', 'remove_custom', 1000 );
1
  • Oh my god, it was that so. Yes I was already hooking to customize_register, so I added now the prioririty and it's working! Thank you.
    – lucgenti
    May 26, 2015 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.