I took down a 25 year old ceiling fan and light and I want to replace it with just a light. I connected 2 black wires to fixture black, 2 white to fixture white, and ground to screw. I capped off red. Light worked but would not turn off by switch. Should I just connect red to black on fixture, 1 white wire to white on fixture ,and cap off extra white and 2 black separately ?
In a setup you have the two black wires need to be put together with the black wire to your light fixture. the two white wires MUST be wired together , then to your white wire to your light fixture. Ground as you have it. Now the red wire can be one of two things, one is a switch leg which was used to turn your light on your ceiling fan off and on. If that was the case then it probably would have been attached to a blue wire in your old ceiling fan. Any way leave it disconnected for now. Once you have the light connected turn power off and on. If it works correctly cap off the red wire and button things up. If not remove the black wire from the light and connect the red wire in its place. test light again then button up.
Sounds like there are 2 three way switches involved, or there was one switch for the fan and one for the light. Being that one red wire exist, I'd guess there's a 3-way
you need a black and a white . one of the blacks should be your 'switch' wire so try them 1 at a time . the two whites can be tied together . the red im not positive about its probably something for a two ( or 3 way whatever they call it) way switch i doubt you will need it, but if neither of the two blacks work seperately definitely try it instead as option 3 on the black fixture wire . . check all your other outlets around the area and if one of them winds up dead then the two blacks likely get tied together and the red is the switched lol . thats how i would attack it anyway lol . im not a residential electrician though im an aviation electrician haha .