Dynamically changing Wordpress permalinks

Posted by conrad on Stack Overflow See other posts from Stack Overflow or by conrad
Published on 2010-12-25T02:37:13Z Indexed on 2010/12/25 2:54 UTC
Read the original article Hit count: 295

Filed under:
|
|

i am trying to write a plugin which rewrites "post_link", "page_link", "category_link", "tag_link" with an action hook on wordpress.

it's similar to this:

add_action("post_link", "the_rewrite_function");

function the_rewrite_function($link) { ... return $new_link; }

for example the permalink to the post is:

http://www.example.com/2010/11/11/the-post-name/

i am changing it with the function to:

http://www.example.com/2010/11/11/the-awesome-post-name/

of course when i do this the new permalink is going to 404 (as expected)

what can i do to make the new permalink go to the original and working one? Please consider this: it should work on any permalink structure so a permalink structure spesific solution won't do any good. i need to solve this inside the plugin.

thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about wordpress-plugin