PluginProbe
Redirection / 4.0.1
Redirection v4.0.1
5.10.0 5.9.0 5.8.1 5.8.0 3.7.2 3.7.3 4.0 4.0.1 4.1 4.1.1 4.2 4.2.1 4.2.2 4.2.3 4.3 4.3.1 4.3.2 4.3.3 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6.2 4.7.1 All 130 releases
redirection / actions / error.php

error.php in Redirection 4.0.1, at actions/error.php

39 lines 782 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Error_Action extends Red_Action {
4 function process_before( $code, $target ) {
5 $this->code = $code;
6
7 wp_reset_query();
8 set_query_var( 'is_404', true );
9
10 add_filter( 'template_include', array( $this, 'template_include' ) );
11 add_filter( 'pre_handle_404', array( $this, 'pre_handle_404' ) );
12 add_action( 'wp', array( $this, 'wp' ) );
13
14 return true;
15 }
16
17 public function wp() {
18 status_header( $this->code );
19 nocache_headers();
20 header( 'X-Redirect-Agent: redirection' );
21 }
22
23 public function pre_handle_404() {
24 global $wp_query;
25
26 // Page comments plugin interferes with this
27 $wp_query->posts = array();
28 return false;
29 }
30
31 public function template_include() {
32 return get_404_template();
33 }
34
35 public function needs_target() {
36 return false;
37 }
38 }
39