Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Just a bugbear about declaring taxonomies, reading Justin Tadlocks article about Taxonomies and want to find what does the 0 mean in this snippet from the above article:

add_action( 'init', 'create_pc_db_taxonomies', 0 );

In the codex article on taxonomies they've omitted it but I see it used just about on every tutorial published so far.

Lastly is there a benefit to calling the above function before the actual function?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The third argument of add_action is the priority, or order in which functions hooked to an action will be executed. from add_action in codex:

(optional) Used to specify the order in which the functions associated with a particular action are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. Default: 10

omitting priority gives your action hook the default priority of 10. in the specific case of the tutorial you linked, I don't see any particular reason why it has to be given a priority of 0.

as for your other question-

Lastly is there a benefit to calling the above function before the actual function

simply defining a function does not call that function. the snippet you posted is hooking that function to an action, in this case init. from codex:

Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Your plugin can specify that one or more of its PHP functions are executed at these points, using the Action API.

When WordPress reaches the init phase of a request, all functions hooked to that action will be called. See the Action Reference in codex for more info and a list of all of the actions WordPress executes in a request.

share|improve this answer
    
Thank you for your answer! –  Beto Oct 22 '12 at 20:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.