I'm working on a plugin, Read Offline, and one of the wishes was for url friendly links. After intensive googling, here's how I did it:
"My Permalink Demo" plugin:
How to test the "My Permalink Demo" plugin
- Save the code above as wp-content/plugins/ps_my_permalink.php, or get the plugin from WordPress.org
- Activate the "My Permalink Demo" plugin
- add the
[mypermalink val="ipsum"] shortcode to a page or post
- Debugging permalink errors is hard, I highly recommend Rewrite Analyzer (it helped me).
- Thanks to Paul, the plugin now only flushes the rewrite rules when needed.
- Fixed a bug in my_permalink_url() that gave 404 for blogs in a subdirectory