There are a lot of traps to choose from when dealing with rats and glue traps, while not being the most humane trap type, are effective in keeping rats from dying in the walls. If a rat dies in a wall there will be a lot of issues you will need to deal with. Rats have very high water content. If they die in a wall they will rot for a long period. A stain will likely appear on the wall and there will be a smell like nothing you have ever experienced. This would require pulling down the drywall to remove the rat or the smell will take months to stop. This is why it is important to use traps to kill rats outside of the walls.
Some popular traps are the traditional snap trap. This trap is made of a hard platform of wood, metal or hard plastic and needs to be baited with food to attract the rats. The most common baits are peanut butter and shellfish shells. When emptying the rat trap of a dead rat make sure to wash the trap to get any of the dead rat smell or throw it out with the rat and set up a fresh new one. If you are using wooden rat snap traps then this can be an affordable way of disposing of the rats without having to touch the actual rat. This type of trap is always effective when done correctly.
The new world of technology has brought us some interesting electronic traps. The human capture trap has a motion sensor and a place to put the bait. The rat enters the door closes and the rat can be taken outside and released. This may be humane but not as helpful if you have not excluded opening in your home rats can get into. The rat can just come back in. That is why there is the rat zap trap. This trap uses batteries to electrocute a rat using a pressure plate that activates when a rat steps on it. This trap electrocutes the rat to death and results in an easy to dispose of dead rat. It is a good idea to clean the pressure plate after each use and to use multiple traps at a time no matter what kind of trap you use.
The last trap that is common to most people is the glue trap. An open glue trap is very dangerous. If you have pets or children they can get caught on it. If you are trying to kill the rats humanely put food on the trap they can eat, poison is a good choice so the rat will die from poison instead of starvation or being eaten by another rat trapped on the same glue trap. These traps can also catch other animals on them. Animals you do not want to catch on them. Enclosed glue traps can be even more inhumane as multiple rats will get caught and will starve and cannibalize each other to survive. It will be a mess and not something you want to have to clean. One of the worst parts of either kind of glue trap is the mess they can make on the floor. The glue on a glue trap is extremely sticky and cannot be cleaned with normal household cleaning products. Instead, you will have to drench it in a strong chemical like WD-40 or mineral spirits for an hour or two and then it should be wiped away with a rag. You will have to do this several times as the glue will not come off all at once.
So why struggle with glue traps when snap traps, capture traps and zap traps can do a better job. Keeping rats from dying in the walls does not have to be a horror movie. Take a leaf from professional exterminators who rarely use glue traps for any reason.