Archived topic
redirect or edit empty Oops page
10 replies · Started by Damon on May 11, 2018
Hi there,
When someone sets up a new account and adds a blog post, they can go to their author page and view it nicely:
https://www.dropbox.com/s/hfvhx8ilr9idtdj/k1.jpeg
However before they post their first blog post, the page is a confusing Oops page:
https://www.dropbox.com/s/vorckvmuzkyi8b5/k2.jpeg?dl=0
Is it possible to redirect or edit this Oops page?
Thank you!
How are you adding the new accounts? I'm not sure which URL you would need to redirect from unfortunately.
The site is a closed community site, with users registering for the community. Then inside the site, the top menu prominently lets them view their own author blog. This works great when they have at least one post. But after registering, they initially have zero posts, and the Oops page appears. That page is confusing, so I’m working on fixing that. Open to any suggestions.
Editing the page would be ideal. Or redirecting it. Or hiding the link and putting an Add First Post link in its place (but then I need to build a lookup and menu item swap). Appreciate any suggestions.
I found this code on the internet, to add to the functions.pho file to redirect 404s. What do you think of this approach?
function wpmudev_js_redirect_404() {
if ( is_404() ) {
?>
<script>
window.location.replace(" https://emprendedor.staging.wpengine.com/buscando-algo/");
</script>
<?php
}
}
add_action('wp_footer','wpmudev_js_redirect_404');
It's not terrible.
You could try something like this instead:
add_action( 'wp', 'tu_redirect_404' );
function tu_redirect_404() {
if ( is_404() ) {
wp_redirect( 'URL TO YOUR PAGE' );
exit;
}
}
Your code didn't work. And since your code always works : ), I'm guessing there's a different issue. Is it possible this is NOT a 404 page, and is in fact another type of error message?
Error message:
https://www.dropbox.com/s/vorckvmuzkyi8b5/k2.jpeg?dl=0
Ah, that's when there's no search results.
This post might help: https://generatepress.com/forums/topic/logo-on-mobile-menu/#post-392010
Thank you Tom. That code is close, but not quite working since this is an author page. I’m guessing this is because there are in fact posts, but none yet by this author.
Here’s the page, until the author creates a first post:
https://www.dropbox.com/s/h0xjsrcuo1xtkhm/1.png?dl=0
Here’s the page after the first post:
https://www.dropbox.com/s/gcvlipa0l2a34k8/2.png?dl=0
I’m trying to redirect that first confusing page to another page that has instructions for creating a first post.
Hmm, any chance you can link me to the actual no results page?
Thanks Tom. I updated the link in my first post In this thread. Login and pwd follow the url, separated with ###. Let me know if any problems, and I’ll send to you another way.
Interesting, I can't find a conditional for the author archives when there's no results. It may be worth asking over on wordpress.stackexchange.com.
If there's a conditional, we should be able to set up the function :)