Skip to main content
Changing init action to template_redirect
Source Link
  1. Wordpress has built in 404 and 403 template, it called in 404.php and 403.php in your template.

  2. OR, You can also defined which page / action will load when specified error code sent by detected http response code, put this on your functions.php file:

function detect_response_header(){ if (http_response_code() == 403) { // do some action here, include template file, redirect to outside wordpress environment (file that not WordPress not involved in your site) or whatever } } add_action('init''template_redirect','detect_response_header'); ref: https://codex.wordpress.org/Plugin_API/Action_Reference/init
  1. Wordpress has built in 404 and 403 template, it called in 404.php and 403.php in your template.

  2. OR, You can also defined which page / action will load when specified error code sent by detected http response code, put this on your functions.php file:

function detect_response_header(){ if (http_response_code() == 403) { // do some action here, include template file, redirect to outside wordpress environment (file that not WordPress not involved in your site) or whatever } } add_action('init','detect_response_header'); ref: https://codex.wordpress.org/Plugin_API/Action_Reference/init
  1. Wordpress has built in 404 and 403 template, it called in 404.php and 403.php in your template.

  2. OR, You can also defined which page / action will load when specified error code sent by detected http response code, put this on your functions.php file:

function detect_response_header(){ if (http_response_code() == 403) { // do some action here, include template file, redirect to outside wordpress environment (file that not WordPress not involved in your site) or whatever } } add_action('template_redirect','detect_response_header'); ref: https://codex.wordpress.org/Plugin_API/Action_Reference/init
Source Link

  1. Wordpress has built in 404 and 403 template, it called in 404.php and 403.php in your template.

  2. OR, You can also defined which page / action will load when specified error code sent by detected http response code, put this on your functions.php file:

function detect_response_header(){ if (http_response_code() == 403) { // do some action here, include template file, redirect to outside wordpress environment (file that not WordPress not involved in your site) or whatever } } add_action('init','detect_response_header'); ref: https://codex.wordpress.org/Plugin_API/Action_Reference/init