template_redirect not working, apparently for no reason

I solved my own problem. I needed to put flush_rewrite_rules( false ); after my register_post_type function. The reason it wasn’t working is because it was returning the page with a 404 error, so I figured out it was a permalinks problem and the code above solved it for me.