[development] what's the best way to create nodes from code?

andrew morton drewish at katherinehouse.com
Fri Oct 30 18:57:46 UTC 2009


On Fri, Oct 30, 2009 at 2:44 PM, Domenic Santangelo
<domenic at workhabit.com> wrote:
> On Oct 30, 2009, at 11:34 AM, Emma Irwin wrote:
>
> Isn't there a need for node_submit() as well before node_save(); ?
>
> In D6, yes. Also to clarify Alex's point, a pure node_submit() + node_save()
> is indeed faster -- because it doesn't hit any hooks. The "proper" way to
> save a node programmatically is in the comments for drupal_execute():

Maybe I'm being a bit too literal but saying you're not hitting *any*
hooks is incorrect. You avoid all the form building and altering calls
but you definitely fire off hooks submit, insert/update hooks.

andrew


More information about the development mailing list