Upgrade to 2.8.4 breaks get_permalink()?
-
Hello WordPress community,
I recently updated my blog to WordPress 2.8.4. **
Since then, a small script I was using to redirect my old Blogger site to the corresponding WordPress post broke. This script had been working for over a year, and I have not changed it.
Here is the small PHP script:
<?php require($_SERVER['DOCUMENT_ROOT'].'/wp-blog-header.php'); $search_link = $_GET['p']; $vars = explode('/', $search_link); $num = count($vars) - 1; $filename = $vars[$num]; $slug = str_replace(".html", "", $filename); $SQL = "SELECT posts.* FROM $wpdb->posts AS posts WHERE posts.post_name = '$slug' LIMIT 1"; $posts = $wpdb->get_results("$SQL"); if ($posts) { foreach ($posts as $post) { $found_link = get_permalink($post->ID); } } else { $found_link = "http://www.gangles.ca/"; } ?> <html> <head> <title>Redirecting...</title> <script language="javascript"><!-- document.location.href="<?php echo ($found_link); ?>"; //--></script> <meta http-equiv="refresh" content="2;url=<?php echo ($found_link); ?>"> </head> <body> <h1>Redirecting...</h1> <p>You can also proceed immediately to <a href="<?php echo ($found_link); ?>"><?php echo ($found_link); ?></a>.</p> <p>The main blog URL is <a href="http://www.gangles.ca/">www.gangles.ca</a>.</p> </body> </html>The problem seems to be that get_permalink($post->ID) is returning a 403 error. For instance:
–This redirect returns 403.
–This one does not, because get_permalink is not called.Is this a known issue? Does anyone know how I can correct my script? As I said before, it was working fine for over a year before I upgraded to 2.8.4.
Any help would be much appreciated,
Matthew** In case this is relevant: At the same time, I made some minor modifications to my .htaccess file (to force trailing slashes and no “www”).
The topic ‘Upgrade to 2.8.4 breaks get_permalink()?’ is closed to new replies.