WordPress.org

Make WordPress Core

Changeset 13888


Ignore:
Timestamp:
03/30/10 12:55:08 (4 years ago)
Author:
nacin
Message:

Clarify order of operations for a child theme removing a filter of a parent theme. see #12695, see #12748

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyten/functions.php

    r13886 r13888  
    1818 * Functions that are not pluggable (not wrapped in function_exists()) are instead attached 
    1919 * to a filter or action hook. The hook can be removed by using remove_action() or 
    20  * remove_filter() and you can attach your own function to the hook. For example: 
     20 * remove_filter() and you can attach your own function to the hook. 
     21 * 
     22 * In this example, since both hooks are attached using the default priority (10), the first 
     23 * one attached (which would be the child theme) will run. We can remove the parent theme's 
     24 * hook only after it is attached, which means we need to wait until setting up the child theme: 
    2125 * 
    2226 * <code> 
    23  * remove_action( 'after_setup_theme', 'twentyten_setup' ); 
    2427 * add_action( 'after_setup_theme', 'my_child_theme_setup' ); 
    2528 * function my_child_theme_setup() { 
    26  *  ... 
     29 *     // We are replacing twentyten_setup() with my_child_theme_setup() 
     30 *     remove_action( 'after_setup_theme', 'twentyten_setup' ); 
     31 *     // We are providing our own filter for excerpt_length (or using the unfiltered value) 
     32 *     remove_filter( 'excerpt_length', 'twentyten_excerpt_length' ); 
     33 *     ... 
    2734 * } 
    2835 * </code> 
Note: See TracChangeset for help on using the changeset viewer.