• What I want it to do:
    install some default categories when I initialize my theme.

    What it does:
    installs the default themes all the time, even after the theme is activated. Result: if I have a default categorie “book” and I rename it to “books”, I have instantly two categories: “book” and “books”.

    function my_setup() {
    $catz = array("test1", "test foto\'s", "test / testing");
    foreach ( $catz as $cat ) {
    	wp_insert_term(
    		$cat,
    		'category'
    	);
    }
    }
    add_action( 'after_setup_theme', 'my_setup' );

    What goes wrong, and how can I get it right to only run the my_setup function once.

    [Moderator Note: No bumping, thank you.]

  • The topic ‘after_setup_theme is always running’ is closed to new replies.