Bare wood that's exposed to the sun for two weeks begins to lose its ability to hold paint. Wood is composed of two main parts - the cellulose fibers and the lignins that hold these fibers together. Ultraviolet light from the sun degrades the lignins, so those on the surface lose the ability to hold the cellulose together.
Since paint sticks to the top layer of cellulose, the paint is will fail if that cellulose isn't adhered to the layers below. The only solution is to sand the wood with 60- to 80-grit paper to provide the best surface for paint adhesion.
Before painting, you should check the moisture level of the wood as paint won't adhere to moisture filled wood. Use a moisture meter. Stable woods such as cedar, redwood, and vertical-grain fir can be painted if they're at 19 percent moisture content or less while less stable woods, such as the standard pressure-treated southern yellow pine, should be closer to 15 percent.