Hi Andrew,
You can put the code in functions.php of your theme or create a plugin out of it.
I copied and pasted your code at the end of the functions.php file of my theme and nothing changed. Thank you for trying.
I was able to get this fixed without hacking core using the following:
Andrew, where did you put your code to make to work?
After searching, reading posts (majority blaming the .htaccess file), and experimenting for hours with no real solution to the issue of only the Default Permalink Settings working in WordPress, I started looking at the settings in my Bluehost hosting account, specifically my database settings. I noticed there was a button called “Repair Database” so I clicked on it. I then went back to my WordPress Admin area and changed my Permalink Settings from Default to Postname. I was pleasantly surprised to see that my pages and posts were working correctly! So, this must be what iPage did for Tammy_Harris.