Support » Fixing WordPress » Can taxonomies be registered in a child theme’s functions.php?

  • Resolved perryb

    (@perryb)


    I am trying out example code from various tutorials for adding taxonomies to WordPress 3.0 (including some from the codex).

    For example:

    // Custom Taxonomy Code
    add_action( 'init', 'build_taxonomies', 0 );
    
    function build_taxonomies() {
    register_taxonomy( 'operating_system', 'post', array( 'hierarchical' => true, 'label' => 'Operating System', 'query_var' => true, 'rewrite' => true ) );
    register_taxonomy( 'ram', 'post', array( 'hierarchical' => true, 'label' => 'RAM', 'query_var' => true, 'rewrite' => true ) );
    register_taxonomy( 'hard_drive', 'post', array( 'hierarchical' => true, 'label' => 'Hard Drive', 'query_var' => true, 'rewrite' => true ) );
    }

    This code does not work in the child but it does if in the parent theme’s functions.php.

    Is this meant to be the case or have I made a mistake somewhere along the line?

Viewing 3 replies - 1 through 3 (of 3 total)
  • perryb, I cannot help much with custom taxonomies (I haven’t looked into them), but I dropped your code into the functions.php of a child theme of Twenty Ten, and it works OK. The taxonomies are registered.

    Thread Starter perryb

    (@perryb)

    That’s odd!

    I pasted it into a blank functions.php in a child theme folder with <?php … ?> wrapped round it and it didn’t even register.

    I wonder what I’ve missed?

    Thread Starter perryb

    (@perryb)

    This is just too stupid – make sure you call name your file in your child theme “functions.php” not “function.php”!!

    Doh – thanks for dropping by demetris!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can taxonomies be registered in a child theme’s functions.php?’ is closed to new replies.