Annie, my parents' 3-year-old Yorkie was a fairly consistent leg-humper before she got spayed nine months ago. (We got her a year ago, previous owners couldn't afford to spay her so she's been through heat at least once that we know of-- dunno if that is relevant). She mostly stopped but usually goes for my leg at least once whenever I'm home for a visit because I was the most permissive about it when she was all over the place.
Actually I still don't see a problem with it. It's funny to me. Especially the way she gets frustrated and barks when I move my leg so she can't get at it