#12806 closed defect (bug) (fixed)
twentyten_setup can't be removed in a clean manner
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 3.0 | Priority: | high |
Severity: | normal | Version: | 3.0 |
Component: | Themes | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
Since child theme's functions.php files are loaded first, you can't use remove_action( 'after_setup_theme', 'twentyten_setup' );
to remove twentyten_setup. The attached patch reverts the change from [13886] and raps twentyten_setup in a functions_exists call to make it pluggable.
Attachments (1)
Change History (11)
#6
@
15 years ago
I don't have a problem with [13923], but I fail to see how the example in the inline docs doesn't handle this without feeling like a hack:
* Functions that are not pluggable (not wrapped in function_exists()) are instead attached * to a filter or action hook. The hook can be removed by using remove_action() or * remove_filter() and you can attach your own function to the hook. * * In this example, since both hooks are attached using the default priority (10), the first * one attached (which would be the child theme) will run. We can remove the parent theme's * hook only after it is attached, which means we need to wait until setting up the child theme: * * <code> * add_action( 'after_setup_theme', 'my_child_theme_setup' ); * function my_child_theme_setup() { * // We are replacing twentyten_setup() with my_child_theme_setup() * remove_action( 'after_setup_theme', 'twentyten_setup' ); * // We are providing our own filter for excerpt_length (or using the unfiltered value) * remove_filter( 'excerpt_length', 'twentyten_excerpt_length' ); * ... * } * </code>
#7
@
15 years ago
I'm fairly certain that is inaccurate though, as you need a higher priority than default.
#8
@
15 years ago
rmccue is correct, it doesn't work on the default priority and getting into action priorities might be getting a bit harder then is needed if we are going to be pushing child themes. I'm all for education, but we should also make the first step into coding WordPress (which is building a theme / child theme) as simple as possible.
Given the reasoning for this patch, I cant see any reason why this function shouldn't be pluggable like the rest of the ones in the file.
Its a much cleaner solution than the hacky solution otherwise required.