Refactor the Junk Drawer: A Safer functions.php Plan for WordPress Themes
That 1,800-line functions.php started as a few snippets and turned into a theme's junk drawer. Here is a practical refactor order, clear rules for theme versus plugin code, and the tests to run before a client deploy.