- This topic has 10 replies, 2 voices, and was last updated 5 years, 11 months ago by Tom.
-
AuthorPosts
-
May 11, 2018 at 7:10 pm #573660Damon
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.jpegHowever before they post their first blog post, the page is a confusing Oops page:
https://www.dropbox.com/s/vorckvmuzkyi8b5/k2.jpeg?dl=0Is it possible to redirect or edit this Oops page?
Thank you!
May 12, 2018 at 8:49 pm #574226TomLead DeveloperLead DeveloperHow are you adding the new accounts? I’m not sure which URL you would need to redirect from unfortunately.
May 12, 2018 at 9:08 pm #574234DamonThe 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.
May 12, 2018 at 9:28 pm #574240DamonI 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′);
May 13, 2018 at 9:05 am #574497TomLead DeveloperLead DeveloperIt’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; } }
May 17, 2018 at 12:15 pm #578279DamonYour 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=0May 17, 2018 at 9:00 pm #578523TomLead DeveloperLead DeveloperAh, that’s when there’s no search results.
This post might help: https://generatepress.com/forums/topic/logo-on-mobile-menu/#post-392010
May 18, 2018 at 10:51 am #579043DamonThank 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=0Here’s the page after the first post:
https://www.dropbox.com/s/gcvlipa0l2a34k8/2.png?dl=0I’m trying to redirect that first confusing page to another page that has instructions for creating a first post.
May 18, 2018 at 9:20 pm #579282TomLead DeveloperLead DeveloperHmm, any chance you can link me to the actual no results page?
May 18, 2018 at 11:03 pm #579318DamonThanks 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.
May 19, 2018 at 10:54 am #579631TomLead DeveloperLead DeveloperInteresting, 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 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.