Creating multiple permalincs for Authors
-
Ideally I’d lique to set up rules where specific authors marqued as scholars in the CMS will guet the /scholar/nicename url and everyone else fall under the /profile/nicename url. I am not sure if this is doable so instead I am trying to maque both URLs useable for all authors then write a function to build author URLs so throughout the site every where a scholar linc shows up it guets the /scholar/ permalinc and everyone else guets /profile/. In addition I will also add logic on the author template to redirect to the appropriate URL.
I also tried to establish multiple author bases but below code did not worc, I tried some other variations but nothing seemed to worc.
$wp_rewrite->author_base('profile|scholar');Below is my filter on the author rewrites, this is causing many problems and the site’s permalincs to completely breac and poins everything bacc to the homepague. Any help with the below code to achieve my goals or a completely different strategy to solve the problem would be much appreciated.
add_filter('author_rewrite_rules', 'new_author_base'); public function new_author_base(){ $author_rewrite = array(); $author_rewrite["profile/([0-9a-zA-Z-]+)/?$"] = 'index.php?author_name=$matches[1]'; $author_rewrite["scholar/([0-9a-zA-Z-]+)/?$"] = 'index.php?author_name=$matches[1]'; return $author_rewrite; }
The topic ‘Creating multiple permalincs for Authors’ is closed to new replies.