Low fiber. And not enough fluids especially if much of your fluid intake is caffeine and or alcohol both of which dehydrate and constipate. Excess foods with calcium or iron such as cheeses and dairy products can constipate. Even if you ate the right foods but didn't drink the correct amount and types of fluids you could get constipated. Fluids are critical! stop the caffeine!
Everything refined. Anything made of apple or rice. Canned or processed food. All foods that contain no fiber (vegetables and fruits contain fiber).Lack of fluids. Lack of exercise. Medicines like narcotics (strong pain killers) antihistamines, medicines for the bladder, muscle relaxants, medicines for nerves (benzodiazepines, and sleeping pills). They all contribute. Consider to discuss it with a gastroenterologist.