Remove the loose strap button from your guitar using a screwdriver, if it hasn't already been pulled out.
Dip a toothpick in some wood glue and insert it into the hole where the strap button sits. Snap off the excess toothpick that's left hanging out of the hole. Repeat this until you can't fit any more toothpicks into the hole.
Leave your guitar overnight so that the glue dries properly, ensuring a sturdier foundation for when you screw your new strap button into the wood of the toothpicks.
Screw your replacement strap button into the hole using a screwdriver; the button's screw end will create new threads in the wood of the toothpick so that the button fits tightly. Keep screwing until the button is securely fixed into the body of your guitar.