Notifications
Clear all

[Closed] How to add a redirect to a custom 404 page

5 Posts
2 Users
1 Reactions
621 Views
Posts: 16
Topic starter
(@systemcrack)
Eminent Member
Joined: 2 years ago

Hi all, I wanted to know if there is a way to add a redirect to wpforo's default 404 page to a custom 404 page.

 

4 Replies
Chris
Posts: 3650
(@chris)
Famed Member
Joined: 3 years ago

Hi @systemcrack,

You can use this hook for that:

$this->current_object = apply_filters( 'wpforo_after_init_current_object', $this->current_object, $wpf_url_parse );
3 Replies
(@systemcrack)
Joined: 2 years ago

Eminent Member
Posts: 16

Be patient @chris  where should i put this piece of code? By chance in the file:

.../wp-content/plugins/wpforo/themes/2022/404.php
Chris
(@chris)
Joined: 3 years ago

Famed Member
Posts: 3650

@systemcrack,

I have provided the hook, but you still need to write a code which would redirect wpForo 404 page to your custom one.

If you cannot write the code, you can contact with Gvectors Custom work team with your request.

Contact Email: sales[at]gvectors.com

Chris
(@chris)
Joined: 3 years ago

Famed Member
Posts: 3650
Inserting the code in Themes functions.php file
 
Add the code at the end(bottom) of the current active theme functions.php file
 
Option one: open functions.php file from wp-content > themes > current active theme.
 
Option Two: Go to Dashboard > Appearance Theme File Editor, select Theme Functions(functions.php) file from Theme Files Bar.
 
Please mention that the code can be lost after updating or changing the theme.
 
 
 
Solution by using Code Snippets Plugin
 
Install and Activate Code Snippets plugin( https://wordpress.org/plugins/code-snippets/).
 
Go to Dashboard > Snippets > Add New.
 
Insert the below code in code field:
 
Select Run snippet everywhere Radio and save the snippet.
 
Check that the new created snippet is active from Dashboard > Snippets > All Snippets.