Random post on 404, seo
-
I have made my 1st php code and I think its amazing lol probably not, it goes to a random post but in a much better way if you go to a 404 on my website yont.co.uk and type some jiberish after a “/” you can see.
My problem is does any one think it will mess my seo up?
In functions.php I replaced
if (theme_get_option('theme_show_random_posts_on_404_page')) {
theme_ob_start();
echo '<h4 class="box-title">' . theme_get_option('theme_show_random_posts_title_on_404_page') . '</h4>';
?>-
<?php
- "><?php the_title(); ?>
global $post;
$rand_posts = get_posts('numberposts=5&orderby=rand');
foreach ($rand_posts as $post) :
?><?php endforeach; ?>
<?php
theme_post_wrapper(array('content' => theme_ob_get_clean()));
}with:
if (theme_get_option('theme_show_random_posts_on_404_page')) {
$posts = get_posts('post_type=post&orderby=rand&numberposts=1');
foreach($posts as $post) {
$link = get_permalink($post);
}
wp_redirect($link,307);
exit;
} -
You did not specify a blog address or reason for posting when you created this topic.
This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.
If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.
If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.
This is an automated message.
- The topic ‘Random post on 404, seo’ is closed to new replies.