AI Assistant
Notifications
Clear all

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

5 Posts
2 Users
1 Reactions
1,522 Views
Posts: 22
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@systemcrack)
Eminent Member
Joined: 4 years ago
[#49657]

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.

 

The page I need help with
wpForo Version
2.1.7
WordPress Version
6.2.2

4 Replies
Chris
Posts: 3610
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@chris)
Famed Member
Joined: 5 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: 4 years ago

Eminent Member
Posts: 22
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

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: 5 years ago

Famed Member
Posts: 3610
Chris
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@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: 5 years ago

Famed Member
Posts: 3610
Chris
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
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.

Share: