[wp-trac] [WordPress Trac] #10570: Flush/Init the $wp_rewrite on theme change.
WordPress Trac
wp-trac at lists.automattic.com
Sun Aug 9 12:39:51 UTC 2009
#10570: Flush/Init the $wp_rewrite on theme change.
-------------------------+--------------------------------------------------
Reporter: frumph | Owner: westi
Type: enhancement | Status: accepted
Priority: normal | Milestone: Future Release
Component: Themes | Version: 2.8
Severity: normal | Keywords: reporter-feedback
-------------------------+--------------------------------------------------
Comment(by frumph):
Just an example off the top of my head, this is no way reflects what the
real code is.. but I was working on having for author pages have it change
the name author/ to users/ or members/ so that I can create member pages
from the author template. Now mind you this works, however switching
themes it keeps the /user/ portion of the rewrite while the rest reverts
back after switching themes. (bad idea for someone who just wants to
check out the theme) So I end up $wp_rewrite->init(); it back after
switching themes in whatever theme i'm working on.
So I was thinking, how does this effect generate_rewrite_rules and all of
those others, apparently they too stay. So having an init(); or
flush_rules(); on switching themes doesn't sound like a bad idea. Premium
templete themes that have special rewrite rules associated with them will
no longer bleed into other themes used.
{{{
if ($some_run_once_var) {
add_action('init','cp_rewrite_author_to_user',5);
}
function cp_rewrite_author_to_user() {
global $wp_rewrite;
$wp_rewrite->author_base = 'user';
$wp_rewrite->flush_rules();
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10570#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list