[wp-hackers] Issue with inserting terms in a register_activation_hook

Philip M. Hofer (Frumph) philip at frumph.net
Mon Sep 6 13:47:07 UTC 2010


What i'm trying to do is add 2 terms to the custom taxonomy 'chapters' that I created.  What is happening is it's just not executing probably because the $checkchapters is returning something (although i cannot capture the error for some reason).  When activating the plugin it gives an error that 'sent prevoius headers' message in amount of byte.

Now this is what i'm assuming, that, that particular portion of code is just unable to be executed from an activation_hook.   When I move the code out to a separate block that is executed in a different location not in the activation hook, it .. sort of works, the first wp_insert_term works, but creating a child off the parent does not, it creates the 2nd term but doesn't make the first term created it's parent (even though the database reports the term_id of the parent, correctly)... I'm obviously missing how to associate the relationship probably.

http://wp.pastebin.com/JgFhfzn3


If I can get a code check on this and maybe confirm aobut the wp_insert_term not being able to be executed from the activation hook.


- Phil


More information about the wp-hackers mailing list