[wp-hackers] Make WP_Rewrite eaiser to use

Peter Westwood peter.westwood at ftwr.co.uk
Mon Feb 6 06:25:17 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sam Angove wrote:
> On 2/6/06, Peter Westwood <peter.westwood at ftwr.co.uk> wrote:
>> I am getting to know it quite well at the moment trying to put together
>> a patch for this old trac ticket - http://trac.wordpress.org/ticket/301
>> (current inprogress patch attached)
> 
> It'll clutter the interface something shocking. I agree with that
> ticket inasmuch as there should be more tokens used, though -- %page%
> instead of hard-coded /page/, %trackback%, %attachment%, %date% etc.
> For i18n if nothing else.
> 
> You can change the bases via plugin; here's one with no admin interface:
> 
> <?php
> /*
> Plugin Name: Ace of Base
> */
> 
> class AllYourBase {
> 	function change_of_base() {
> 		global $wp_rewrite;
> 		$wp_rewrite->feed_base = 'dinner';
> 		$wp_rewrite->author_base = 'hemingway';
> 		$wp_rewrite->comments_base = 'gossip';
> 		$wp_rewrite->search_base = 'mountainview';
> 	}
> }
> add_filter( 'init', array('AllYourBase', 'change_of_base') );
> ?>

This will work _except_ for feeds.  The rewrite rules for feeds expect
the feed_base to be feed and don't match when it is changed - you end up
with the feed links 404'ing.

This is the part of the patch that has been causing me the most grief
but I'm getting there.

westi
- --
Peter Westwood
http://blog.ftwr.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFD5uvNVPRdzag0AcURAtRYAJ0elU+YoQAMI7WRf/IOj6N1LhgzyACgzU9z
6764hIr+KWt3D/uqJZ9t4jE=
=UYqh
-----END PGP SIGNATURE-----



More information about the wp-hackers mailing list