Version Description
bugfix for WP 6.1
Download this release
Release Info
Developer | petersplugins |
Plugin | 404page – your smart custom 404 error page |
Version | 11.4.3 |
Comparing to | |
See all releases |
Code changes from version 11.4.2 to 11.4.3
- 404page.php +1 -1
- inc/class-404page.php +15 -8
- loader.php +1 -1
- readme.txt +7 -1
404page.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* Plugin Name: Smart Custom 404 error page [404page]
|
10 |
* Plugin URI: https://petersplugins.com/404page/
|
11 |
* Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
|
12 |
-
* Version: 11.4.
|
13 |
* Author: Peter Raschendorfer
|
14 |
* Author URI: https://petersplugins.com
|
15 |
* Text Domain: 404page
|
9 |
* Plugin Name: Smart Custom 404 error page [404page]
|
10 |
* Plugin URI: https://petersplugins.com/404page/
|
11 |
* Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
|
12 |
+
* Version: 11.4.3
|
13 |
* Author: Peter Raschendorfer
|
14 |
* Author URI: https://petersplugins.com
|
15 |
* Text Domain: 404page
|
inc/class-404page.php
CHANGED
@@ -243,7 +243,8 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
243 |
|
244 |
// Compatibility Mode
|
245 |
// as of v 2.4 we use the the_posts filter instead of posts_results, because the posts array is internally processed after posts_results fires
|
246 |
-
|
|
|
247 |
|
248 |
// as of v 2.5 we remove the filter if the DW Question & Answer plugin by DesignWall (https://www.designwall.com/wordpress/plugins/dw-question-answer/) is active and we're in the answers list
|
249 |
add_filter( 'dwqa_prepare_answers', array( $this, 'remove_show404_compatiblity_mode' ), 999 );
|
@@ -328,12 +329,13 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
328 |
* show 404 page
|
329 |
* Compatibility Mode
|
330 |
*/
|
331 |
-
function show404_compatiblity_mode( $posts ) {
|
332 |
|
333 |
global $wp_query;
|
334 |
|
335 |
// remove the filter so we handle only the first query - no custom queries
|
336 |
-
|
|
|
337 |
|
338 |
// @since 4
|
339 |
// fix for an ugly bbPress problem
|
@@ -359,7 +361,11 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
359 |
|
360 |
// as of v 11.0.3 we also check for REST_REQUEST to not create a 404 page in case of REST API call
|
361 |
// as of v 11.2.4 we also check for DOING_CRON
|
362 |
-
|
|
|
|
|
|
|
|
|
363 |
|
364 |
// save URL that caused the 404 - since 11.4.0
|
365 |
$this->set_404_url();
|
@@ -373,6 +379,9 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
373 |
|
374 |
remove_action( 'pre_get_posts', array ( $this, 'exclude_404page' ) );
|
375 |
remove_filter( 'get_pages', array ( $this, 'remove_404page_from_array' ), 10, 2 );
|
|
|
|
|
|
|
376 |
|
377 |
$this->disable_caching();
|
378 |
|
@@ -382,8 +391,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
382 |
// @since 8
|
383 |
// added suppress_filters for compatibilty with current WPML version
|
384 |
$wp_query->query( array( 'page_id' => $pageid, 'suppress_filters' => true ) );
|
385 |
-
|
386 |
-
|
387 |
$wp_query->the_post();
|
388 |
$this->template = get_page_template();
|
389 |
$posts = $wp_query->posts;
|
@@ -392,8 +400,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
392 |
add_action( 'wp', array( $this, 'do_404_header' ) );
|
393 |
add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
|
394 |
add_filter( 'template_include', array( $this, 'change_404_template' ), 999 );
|
395 |
-
|
396 |
-
|
397 |
|
398 |
$this->maybe_force_404();
|
399 |
$this->do_404page_action();
|
243 |
|
244 |
// Compatibility Mode
|
245 |
// as of v 2.4 we use the the_posts filter instead of posts_results, because the posts array is internally processed after posts_results fires
|
246 |
+
// as of v 11.4.3 we also pass the query
|
247 |
+
add_filter( 'the_posts', array( $this, 'show404_compatiblity_mode' ), 999, 2 );
|
248 |
|
249 |
// as of v 2.5 we remove the filter if the DW Question & Answer plugin by DesignWall (https://www.designwall.com/wordpress/plugins/dw-question-answer/) is active and we're in the answers list
|
250 |
add_filter( 'dwqa_prepare_answers', array( $this, 'remove_show404_compatiblity_mode' ), 999 );
|
329 |
* show 404 page
|
330 |
* Compatibility Mode
|
331 |
*/
|
332 |
+
function show404_compatiblity_mode( $posts, $query ) {
|
333 |
|
334 |
global $wp_query;
|
335 |
|
336 |
// remove the filter so we handle only the first query - no custom queries
|
337 |
+
// moved in 11.4.3 due to problems with WP 6.1
|
338 |
+
// remove_filter( 'the_posts', array( $this, 'show404_compatiblity_mode' ), 999 );
|
339 |
|
340 |
// @since 4
|
341 |
// fix for an ugly bbPress problem
|
361 |
|
362 |
// as of v 11.0.3 we also check for REST_REQUEST to not create a 404 page in case of REST API call
|
363 |
// as of v 11.2.4 we also check for DOING_CRON
|
364 |
+
|
365 |
+
// is_main_query() is true in multiple cases
|
366 |
+
// as of v 11.4.3 we check the query against the main query
|
367 |
+
|
368 |
+
if ( ( empty( $posts ) || ( isset( $wp_query->query['error'] ) && $wp_query->query['error'] == 404 ) ) && $wp_query == $query && is_main_query() && !is_robots() && !is_home() && !is_feed() && !is_search() && !is_archive() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && ( !defined('DOING_CRON') || !DOING_CRON ) && ( !defined('REST_REQUEST') || !REST_REQUEST ) ) {
|
369 |
|
370 |
// save URL that caused the 404 - since 11.4.0
|
371 |
$this->set_404_url();
|
379 |
|
380 |
remove_action( 'pre_get_posts', array ( $this, 'exclude_404page' ) );
|
381 |
remove_filter( 'get_pages', array ( $this, 'remove_404page_from_array' ), 10, 2 );
|
382 |
+
|
383 |
+
// moved here in 11.4.3
|
384 |
+
remove_filter( 'the_posts', array( $this, 'show404_compatiblity_mode' ), 999 );
|
385 |
|
386 |
$this->disable_caching();
|
387 |
|
391 |
// @since 8
|
392 |
// added suppress_filters for compatibilty with current WPML version
|
393 |
$wp_query->query( array( 'page_id' => $pageid, 'suppress_filters' => true ) );
|
394 |
+
|
|
|
395 |
$wp_query->the_post();
|
396 |
$this->template = get_page_template();
|
397 |
$posts = $wp_query->posts;
|
400 |
add_action( 'wp', array( $this, 'do_404_header' ) );
|
401 |
add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
|
402 |
add_filter( 'template_include', array( $this, 'change_404_template' ), 999 );
|
403 |
+
|
|
|
404 |
|
405 |
$this->maybe_force_404();
|
406 |
$this->do_404page_action();
|
loader.php
CHANGED
@@ -56,7 +56,7 @@ function pp_404page() {
|
|
56 |
'slug' => pathinfo( dirname( __FILE__ ) . '/404page.php', PATHINFO_FILENAME ),
|
57 |
'name' => 'Smart Custom 404 error page [404page]',
|
58 |
'shortname' => '404page',
|
59 |
-
'version' => '11.4.
|
60 |
) );
|
61 |
|
62 |
}
|
56 |
'slug' => pathinfo( dirname( __FILE__ ) . '/404page.php', PATHINFO_FILENAME ),
|
57 |
'name' => 'Smart Custom 404 error page [404page]',
|
58 |
'shortname' => '404page',
|
59 |
+
'version' => '11.4.3'
|
60 |
) );
|
61 |
|
62 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: petersplugins
|
|
3 |
Tags: page, 404, error, error page, 404 page, page not found, page not found error, 404 error page, missing, broken link, template, 404 link, seo, custom 404, custom 404 page, custom 404 error, custom 404 error page, customize 404, customize 404 page, customize 404 error page, classicpress
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 6.1
|
6 |
-
Stable tag: 11.4.
|
7 |
Requires PHP: 5.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -196,6 +196,9 @@ Please use the [Support Forum](https://wordpress.org/support/plugin/404page).
|
|
196 |
|
197 |
== Changelog ==
|
198 |
|
|
|
|
|
|
|
199 |
= 11.4.2 (2022-11-01) =
|
200 |
* also add class error404 to body tag if page is called directly
|
201 |
* plugin renamed
|
@@ -405,6 +408,9 @@ Please use the [Support Forum](https://wordpress.org/support/plugin/404page).
|
|
405 |
|
406 |
== Upgrade Notice ==
|
407 |
|
|
|
|
|
|
|
408 |
= 11.4.2 =
|
409 |
also add class error404 to body tag if page is called directly
|
410 |
|
3 |
Tags: page, 404, error, error page, 404 page, page not found, page not found error, 404 error page, missing, broken link, template, 404 link, seo, custom 404, custom 404 page, custom 404 error, custom 404 error page, customize 404, customize 404 page, customize 404 error page, classicpress
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 6.1
|
6 |
+
Stable tag: 11.4.3
|
7 |
Requires PHP: 5.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
196 |
|
197 |
== Changelog ==
|
198 |
|
199 |
+
= 11.4.3 (2022-11-05) =
|
200 |
+
* bugfix for WP 6.1
|
201 |
+
|
202 |
= 11.4.2 (2022-11-01) =
|
203 |
* also add class error404 to body tag if page is called directly
|
204 |
* plugin renamed
|
408 |
|
409 |
== Upgrade Notice ==
|
410 |
|
411 |
+
= 11.4.3 =
|
412 |
+
bugfix for WP 6.1
|
413 |
+
|
414 |
= 11.4.2 =
|
415 |
also add class error404 to body tag if page is called directly
|
416 |
|