WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#14899 closed defect (bug) (invalid)

Remove Theme Support not Working

Reported by: adeptris Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: General Keywords:
Focuses: Cc:

Description

I have a "twenty ten" child theme and I want to disable the Custom Header and Custom Background Support, I added this code to my functions.php but it is not working.

I have tried the following in the Child Theme function.php

/* Remove theme support for Background and Headers */
function remove_custom_theme_support(){
	remove_theme_support('custom-header');
	remove_theme_support('custom-background');
}
add_action( 'after_setup_theme', 'remove_custom_theme_support', 11 );

I have also tried

/* Remove theme support for Background and Headers */
function remove_custom_theme_support(){
	remove_theme_support('custom-header');
	remove_theme_support('custom-background');
}
add_action( 'init', 'remove_custom_theme_support' );

I have tried Google and Codex, is this a know bug. or my code?

Codex says!
Allows a theme to de-register its support of a certain feature. Should be called in the theme's functions.php file. Generally would be used for child themes to override support from the parent theme.

David

David

Change History (5)

#1 @nacin
11 years ago

These are internal only. Removing theme support will only cause an issue.

I'm not sure if we have proper callback deregistration functions for headers and backgrounds. Point is even if we didn't blacklist these in remove_theme_support, it wouldn't do anything.

#2 @adeptris
11 years ago

Hi Nacin,
Not sure what Blacklist means, in codex we have add_theme_support('custom-header'), and the remove_theme_support() listed for use with child themes.

In the "twenty ten" theme these are added in the functions.php, in a best practice using a child theme, how would we remove the Header and Background sections from Admin > Appearance, if not with this call is there another way or function we could use?

Kind Regards

David

#3 @nacin
11 years ago

  • Keywords remove theme support twenty ten child theme removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

I've rewritten the Codex page. http://codex.wordpress.org/Function_Reference/add_theme_support

There are no API calls for disabling the header, background, or editor style features. (There are for menu locations and widget sidebars.)

Those should probably be proposed and dealt with in 3.1.

#4 @nacin
11 years ago

#14903 opened.

#5 @adeptris
11 years ago

Many Thanks,
I can proceed on that basis, de-register the default images, create a default header image with text overlaid, and change the <body> element, they will still be there but have no impack on the theme.

Thanks again to everybody, I know sometimes writing code for free seems like a thankless task.

David

Note: See TracTickets for help on using tickets.