you have a few options, sometimes a good quality trade oil based undercoat will stop it but not guaranteed.
you can buy a knotting solution which you apply by cloth to the knot and surrounding area, however the knotting solutions on the market today are not as good as in the past (e u regs) but for skirtings they should work ok but i wouldn't use on doors.
the best i find is what's classed as stain blocker/sealer, i use the shallack based zinnser (it's either bin 123 or bullseye. must be oil based not water,) the beauty of this is you can also use as your primer coat but make sure area is well ventillated, it dries very quickly and gives an excellent base, slightly more costly than other 2 methods but once done you never have to worry about again.
which ever method you choose it must be done prior to priming, and ensure the areas are clean of any dust/grease.
hope of some help nigel.