404page

PLUGIN DOC

The 404page Plugin allows you define any of your pages as 404 error page so you can use the full power of WordPress to create your custom 404 error page without the need of programming skills.

Introduction

The 404 is a HTTP standard response code which indicates that the client was able to communicate with the server but the server could not find what was requested. If the server does not send a page to be displayed together with the error code the browser shows a default error message, which looks different depending on the used webbrowser. You can’t avoid 404 errors on your site so it should be needless to say your site should have a custom 404 error page fitting your design instead of showing your visitors a more or less ugly browser error message.

WordPress and 404 error pages

WordPress comes with a built-in feature to deliver a 404 error page when an 404 error occurs. To enable this feature the only thing you have to do is to change the Permalink Structure to anything else but Default. As long a you leave this setting to Default the 404 errors are not handled by WordPress but by the webserver.

Creating a custom 404 error page for your WordPress driven site

In WordPress the 404 error page is part of the Theme. Without using the 404page Plugin you would need programming skills to create a custom 404 page. The plugin allows you to create and change your 404 error page as a normal page using the full power of WordPress and making use of all installed pluings and available shortcodes. Just select any page as 404 error page in Appearance -> 404 Error Page.

The 404page plugin does not redirect your browser to the given page. That’s important because it ensures that a correct code 404 is delivered. This tells search engines that the page does not exist and has to be removed from the index. A redirect would result in a HTTP code 301 or 302 and the page would remain in the search index.

Settings

404page - your smart custom 404 error page - free WordPress Plugin

Page to be displayed as 404 page

Select the page you want to be displayed as your custom 404 error page from the dropdown list. You first have to create the page from the Pages menu. The Edit Page button allows you to edit the selected page directly from here. The Test 404 error button opens a page with a randomly generated URL which should cause an 404 error. If you select a different page both buttons are disabled and you have to save the settings to enable them again.

Hide 404 page

Activating this option hides the page you selected as custom 404 error page from the Pages menu for non admin users. For admin users it’s always visible. The page selected as 404 page is marked with the 404page icon.

404page - your smart custom 404 error page - free WordPress Plugin

Fire 404 error

This option is activated by default and it is recommended not to change this setting. With this option active WordPress fires an 404 error in case the page you selected to be your custom 404 error page is accessed directly by its permalink. The only reason to deactivate this option is if you explicitly want the page to be accessible – e.g. if you use the page otherwhere.

WP Super Cache Compatibility

If you are using the WP Super Cache plugin for caching also the page you defined as your custom 404 error page will be cached and WP Super Cache will always send a HTTP code 200 and not a 404. To avoid this behavior you have to exlude the page from caching. If the 404page plugin detects the WP Super Cache plugin it will show you a message hereof. This may also relate to other caching plugins.

Operating Method

Standard Mode is the default Operating Method and should work in most cases. This mode uses the WordPress Template System to detect and handle 404 errors. Some plugins and themes bypass this task, thus the 404page plugin does not work properly. In such cases please try to switch to Compatibility Mode. The Compatibility Mode uses its completely own method to detect and handle 404 errors. Only use it if you have any problems.

Special Operating Methods

If the 404page plugin detects one of the following plugins or themes it switches to a specific adapted mode for best compatibility:

Native Mode

A theme can activate the native mode to fully control the 404page plugin.

For developers

CSS styling

The plugin adds a CSS class error404 to the <body> HTML tag. You can use this class for extra styling.

Action Hook

The plugin adds an action hook 404page_after_404 which you can use to add extra functionality. The exact position the action occurs after an 404 error is detected depends on the Operating Method. Your function must not generate any output. There are no parameters.

Native theme support

As a theme developer you can activate a special native mode to fully control the 404page plugin.

PP_404

If the 404page plugin is installed and activated it defines the PHP constant PP_404. Check existence of it to detect the 404page plugin.

pp_404_is_active

The pp_404_is_active() functions returns true if there is a custom 404 page selected in the plugin’s settings and the selected page exists. Otherwise it returns false.

pp_404_set_native_support

Call the pp_404_set_native_support() function to activate native mode. If native mode is activated the 404page plugin does not generate any output. Independently, the error404 CSS class is added to the <body> tag anyway.

pp_404_get_the_title

The pp_404_get_the_title() function retrieves the title of the custom 404 error page, like get_the_title(). It accepts no parameters.

pp_404_the_title

The pp_404_the_title() function displays the title of the custom 404 erro page, like the_title(). It accepts no parameters.

pp_404_get_the_content

The pp_404_get_the_content() function retrieves the content of the custom 404 error page, like get_the_content(). It accepts no parameters.

pp_404_the_content

The pp_404_the_content() function displays the content of the custom 404 erro page, like the_content(). It accepts no parameters.

Sample code

Important advice: This sample code just illustrates how the native mode works. The pp_404_set_native_support() function must not be used inside a template file. You have to call it in the functions.php file of your theme immediately. This ensures that the Operating Method setting is deactivated on the settings page and a message is shown that native mode is active.

View related Plugin

Short URL to this page: http://p12.click/433sn