Use the wp function that exists...

and remove the warnings about nonexistent objects.