Version Description
exclude 404 page from XML sitemap generated by Jetpack
Download this release
Release Info
Developer | petersplugins |
Plugin | 404page – your smart custom 404 error page |
Version | 11.1.2 |
Comparing to | |
See all releases |
Code changes from version 11.1.1 to 11.1.2
- 404page.php +1 -1
- assets/css/404page-ui.css +2 -0
- inc/class-404page-admin.php +21 -1
- inc/class-404page.php +18 -3
- loader.php +1 -1
- readme.txt +7 -1
404page.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* Plugin Name: 404page - your smart custom 404 error page
|
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.1.
|
13 |
* Author: Peter Raschendorfer
|
14 |
* Author URI: https://petersplugins.com
|
15 |
* Text Domain: 404page
|
9 |
* Plugin Name: 404page - your smart custom 404 error page
|
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.1.2
|
13 |
* Author: Peter Raschendorfer
|
14 |
* Author URI: https://petersplugins.com
|
15 |
* Text Domain: 404page
|
assets/css/404page-ui.css
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
#select404page {
|
|
|
2 |
width: 100%;
|
|
|
3 |
}
|
4 |
|
5 |
.pp-404page-videos:after {
|
1 |
#select404page {
|
2 |
+
display: block;
|
3 |
width: 100%;
|
4 |
+
max-width: none;
|
5 |
}
|
6 |
|
7 |
.pp-404page-videos:after {
|
inc/class-404page-admin.php
CHANGED
@@ -172,7 +172,7 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
|
172 |
}
|
173 |
|
174 |
wp_dropdown_pages( array( 'name' => $this->settings()->get_option_name() . '[page_id]', 'id' => 'select404page', 'echo' => 1, 'show_option_none' => esc_html__( '— NONE (WP default 404 page) —', '404page'), 'option_none_value' => '0', 'selected' => $this->settings()->get( 'page_id' ) ) );
|
175 |
-
|
176 |
echo '<div id="404page_edit_link" style="display: none">' . get_edit_post_link( $this->settings()->get( 'page_id' ) ) . '</div>';
|
177 |
echo '<div id="404page_test_link" style="display: none">' . get_site_url() . '/404page-test-' . md5( rand() ) . '</div>';
|
178 |
echo '<div id="404page_current_value" style="display: none">' . $this->settings()->get( 'page_id' ) . '</div>';
|
@@ -198,6 +198,26 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
|
198 |
|
199 |
}
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
}
|
202 |
|
203 |
|
172 |
}
|
173 |
|
174 |
wp_dropdown_pages( array( 'name' => $this->settings()->get_option_name() . '[page_id]', 'id' => 'select404page', 'echo' => 1, 'show_option_none' => esc_html__( '— NONE (WP default 404 page) —', '404page'), 'option_none_value' => '0', 'selected' => $this->settings()->get( 'page_id' ) ) );
|
175 |
+
|
176 |
echo '<div id="404page_edit_link" style="display: none">' . get_edit_post_link( $this->settings()->get( 'page_id' ) ) . '</div>';
|
177 |
echo '<div id="404page_test_link" style="display: none">' . get_site_url() . '/404page-test-' . md5( rand() ) . '</div>';
|
178 |
echo '<div id="404page_current_value" style="display: none">' . $this->settings()->get( 'page_id' ) . '</div>';
|
198 |
|
199 |
}
|
200 |
|
201 |
+
if ( defined( 'JETPACK__VERSION' ) && method_exists( 'Jetpack', 'is_module_active' ) && Jetpack::is_module_active( 'sitemaps' ) ) {
|
202 |
+
|
203 |
+
// Jetpack since version 11.1.2
|
204 |
+
|
205 |
+
echo '<p class="pp-404page-info">';
|
206 |
+
|
207 |
+
if ( $this->settings()->get( 'fire_error' ) ) {
|
208 |
+
|
209 |
+
echo esc_html__( 'Jetpack sitemap detected. Your 404 page is automatically excluded from the XML sitemap created by Jetpack.', '404page' );
|
210 |
+
|
211 |
+
} else {
|
212 |
+
|
213 |
+
echo esc_html__( 'Jetpack sitemap detected. Your 404 page is NOT automatically excluded from the XML sitemap created by Jetpack, because you disabled the option "Send an 404 error if the page is accessed directly by its URL" on the "Advanced" tab.', '404page' );
|
214 |
+
|
215 |
+
}
|
216 |
+
|
217 |
+
echo '</p>';
|
218 |
+
|
219 |
+
}
|
220 |
+
|
221 |
}
|
222 |
|
223 |
|
inc/class-404page.php
CHANGED
@@ -147,17 +147,32 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
147 |
add_filter( 'redirect_canonical' ,array ( $this, 'no_url_guessing' ) );
|
148 |
}
|
149 |
|
150 |
-
|
|
|
151 |
// only if "Send an 404 error if the page is accessed directly by its URL" is active
|
152 |
-
// @since 6
|
153 |
if ( $this->settings()->get( 'fire_error' ) ) {
|
154 |
|
|
|
|
|
|
|
155 |
// we do not need to check if Yoast Sitemap feature is activated because the filter only fires if it is active
|
156 |
add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', function ( $alreadyExcluded ) {
|
157 |
// as of 11.0.5 we add the page ID to the array of already excluded pages
|
158 |
// plus we exclude the 404 page in all languages
|
159 |
return array_merge( $alreadyExcluded, $this->get_all_page_ids() );
|
160 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
}
|
163 |
|
147 |
add_filter( 'redirect_canonical' ,array ( $this, 'no_url_guessing' ) );
|
148 |
}
|
149 |
|
150 |
+
|
151 |
+
// Remove 404 error page from XML sitemaps
|
152 |
// only if "Send an 404 error if the page is accessed directly by its URL" is active
|
|
|
153 |
if ( $this->settings()->get( 'fire_error' ) ) {
|
154 |
|
155 |
+
// YOAST sitemap
|
156 |
+
// @since 6
|
157 |
+
|
158 |
// we do not need to check if Yoast Sitemap feature is activated because the filter only fires if it is active
|
159 |
add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', function ( $alreadyExcluded ) {
|
160 |
// as of 11.0.5 we add the page ID to the array of already excluded pages
|
161 |
// plus we exclude the 404 page in all languages
|
162 |
return array_merge( $alreadyExcluded, $this->get_all_page_ids() );
|
163 |
+
}, 999 );
|
164 |
+
|
165 |
+
|
166 |
+
// Jetpack sitemap
|
167 |
+
// @since 11.1.2
|
168 |
+
|
169 |
+
// we do not need to check if Jetpack Sitemap feature is activated because the filter only fires if it is active
|
170 |
+
add_filter( 'jetpack_sitemap_skip_post', function ( $skip, $post ) {
|
171 |
+
if ( in_array( intval( $post->ID ), $this->get_all_page_ids() ) ) {
|
172 |
+
$skip = true;
|
173 |
+
}
|
174 |
+
return $skip;
|
175 |
+
}, 999, 2 );
|
176 |
|
177 |
}
|
178 |
|
loader.php
CHANGED
@@ -42,7 +42,7 @@ function pp_404page() {
|
|
42 |
'slug' => pathinfo( dirname( __FILE__ ) . '/404page.php', PATHINFO_FILENAME ),
|
43 |
'name' => '404page - your smart custom 404 error page',
|
44 |
'shortname' => '404page',
|
45 |
-
'version' => '11.1.
|
46 |
) );
|
47 |
|
48 |
}
|
42 |
'slug' => pathinfo( dirname( __FILE__ ) . '/404page.php', PATHINFO_FILENAME ),
|
43 |
'name' => '404page - your smart custom 404 error page',
|
44 |
'shortname' => '404page',
|
45 |
+
'version' => '11.1.2'
|
46 |
) );
|
47 |
|
48 |
}
|
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: 5.3
|
6 |
-
Stable tag: 11.1.
|
7 |
Requires PHP: 5.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -171,6 +171,9 @@ Please use the [Support Forum](https://wordpress.org/support/plugin/404page).
|
|
171 |
|
172 |
== Changelog ==
|
173 |
|
|
|
|
|
|
|
174 |
= 11.1.1 (2019-11-16) =
|
175 |
* from now on it is not only detected if Yoast SEO Plugin is active, but also if the sitemap feature is activated
|
176 |
|
@@ -329,6 +332,9 @@ Please use the [Support Forum](https://wordpress.org/support/plugin/404page).
|
|
329 |
|
330 |
== Upgrade Notice ==
|
331 |
|
|
|
|
|
|
|
332 |
= 11.1.1 =
|
333 |
Yoast SEO sitemap feature detection
|
334 |
|
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: 5.3
|
6 |
+
Stable tag: 11.1.2
|
7 |
Requires PHP: 5.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
171 |
|
172 |
== Changelog ==
|
173 |
|
174 |
+
= 11.1.2 (2019-11-19) =
|
175 |
+
* exclude 404 page from XML sitemap generated by Jetpack
|
176 |
+
|
177 |
= 11.1.1 (2019-11-16) =
|
178 |
* from now on it is not only detected if Yoast SEO Plugin is active, but also if the sitemap feature is activated
|
179 |
|
332 |
|
333 |
== Upgrade Notice ==
|
334 |
|
335 |
+
= 11.1.2 =
|
336 |
+
exclude 404 page from XML sitemap generated by Jetpack
|
337 |
+
|
338 |
= 11.1.1 =
|
339 |
Yoast SEO sitemap feature detection
|
340 |
|