From a shared blog to a personal site..

To ease the transition from the previous incarnation of this blog (a shared blog) to a more focused, personal blog, I used the WordPress Import/Export feature to transfer all of my own posts into the new WordPress instance. In order not to disrupt other contributors and leave the old history intact, I whipped up this quick plug-in to redirect requests for my posts to the new blog:

/*
Plugin Name: Author posts redirect
Plugin URI: http://cbeer.info/blog/2010/07/18/from-a-shared-blog-to-a-personal-site
Description: Redirect an author's posts to a new url..
Version: 0.0a
Author: Chris Beer
Author URI: http://cbeer.info
*/

add_action('the_post', 'redirect_author_post');

function redirect_author_post($post) {
  if($post->post_author == 2 && is_single()) {
    header("HTTP/1.1 301 Moved Permanently");
    header('Location: ' . str_replace('http://authoritativeopinion.com/', 'http://cbeer.info/', $post->guid ));
    die();
  }
}
This entry was posted in Code. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>