Hi, I'm running the following script on a WordPress blog that has changed domains to do a 301 Redirect to the new spot. Here's the code: <?php define( 'BLOCK_LOAD', true ); require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php' ); require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php' ); $post_obj = $wp_query->get_queried_object(); $post_ID = $post_obj->ID; $post_title = $post_obj->post_title; $post_slug = $post_obj->post_name; $post_date = $wpdb->get_results("SELECT post_date FROM $wpdb->posts WHERE post_name = '$post_slug'"); list($y, $m, $d) = explode('-', substr($post_date, 0, 9)); $new_url = 'http://www.example.com/TEAM-NAME/'.$y.'/'.$m.'/'.$d.'/'.$post_slug.'/'; Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: ".$new_url."" ); ?> Code (markup): And its outputting to: http://www.example.com/TEAM-NAME/Array/team-usa-has-alot-to-look-forward-too/ Thanks
Fixed. Added this after DB query: foreach($post_date as $post_day) { $postted_date = $post_day->post_date; }