[wp-hackers] register_*() vs. add_*()?

Otto otto at ottodestruct.com
Sat Mar 19 19:47:31 UTC 2011


The real reason is probably just time and different people writing
different bits.

But if you wanted to standardize a bit, I'd say that registering
something "creates" it without taking any other real action, while
adding something more often causes other sub-thing to happen. Of
course, there's exceptions and this is open to interpretation, but
that's about the gist of it, I think.

-Otto



On Sat, Mar 19, 2011 at 1:17 PM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> I'm trying to understand the rationale between prefixing core functions with "register_" vs. "add_" as a prefix.  I can't seem to recognize why one is used at times and the other is used at times.  Examples from core:
>
> add_shortcode()
> add_rewrite_rule()
> add_action()
> add_custom_background()
>
> register_post_type()
> register_taxonomy()
> register_nav_menu()
> register_sidebar()
>
> I'm working on code I could envision offering up as proposed additions to core so that's why I'm interested in the difference.
>
> Thanks in advance.
>
> -Mike
> P.S. I think I asked this question on trac before but didn't get a good answer.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list