Do not use WD40 on firearms. Period. Now, I'm sure someone will post here saying they've used WD40 for years on their guns and it's OK for the purpose. But guess what. They're wrong.
How else can I make that spectacularly sticky glaze inside of every little crevice that is almost impossible to get out without a cutting torch or some kind of thermonuclear device?
My dad is a die-hard WD40 fan. He said they would spray it into their 1911 mags on the firing line to prevent misfeeds at matches. All of his guns are beautiful on the outside 60 years later, but holy crap, the goo that forms inside of things is unbelievable. My gunsmith had to use a reamer on one of his 1911s to get the extractor channel clean.
Back to OP: grease is good, but also you need something better to protect the metal where you don't grease it. CLP or Eezox is good. Gun oil is probably OK too if you don't live someplace that eats guns (near the ocean, high humidity, lots of rain, etc.).