All 404 Redirect to Homepage - Version 3.6

Version Description

  • show alert message if you have many broken links
  • compatibility check with wordpress 6.0
Download this release

Release Info

Developer osamaesh
Plugin Icon 128x128 All 404 Redirect to Homepage
Version 3.6
Comparing to
See all releases

Code changes from version 3.5 to 3.6

Files changed (3) hide show
  1. all-404-redirect-to-homepage.php +2 -1
  2. functions.php +49 -0
  3. readme.txt +7 -2
all-404-redirect-to-homepage.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: All 404 Redirect to Homepage
4
  Plugin URI: https://www.wp-buy.com
5
  Description: a plugin to redirect 404 pages to home page or any custom page
6
  Author: wp-buy
7
- Version: 3.5
8
  Author URI: https://www.wp-buy.com
9
  */
10
  register_activation_hook( __FILE__, 'p404_modify_htaccess' );
@@ -20,6 +20,7 @@ add_action('admin_head', 'p404_header_code');
20
  add_action('wp', 'p404_redirect');
21
  add_action( 'admin_enqueue_scripts', 'p404_enqueue_styles_scripts' );
22
  add_action('wp_ajax_P404REDIRECT_HideMsg', 'P404REDIRECT_HideMsg');
 
23
 
24
 
25
  function P404REDIRECT__filter_action_links( $links ) {
4
  Plugin URI: https://www.wp-buy.com
5
  Description: a plugin to redirect 404 pages to home page or any custom page
6
  Author: wp-buy
7
+ Version: 3.6
8
  Author URI: https://www.wp-buy.com
9
  */
10
  register_activation_hook( __FILE__, 'p404_modify_htaccess' );
20
  add_action('wp', 'p404_redirect');
21
  add_action( 'admin_enqueue_scripts', 'p404_enqueue_styles_scripts' );
22
  add_action('wp_ajax_P404REDIRECT_HideMsg', 'P404REDIRECT_HideMsg');
23
+ add_action('wp_ajax_P404REDIRECT_HideAlert', 'P404REDIRECT_HideAlert');
24
 
25
 
26
  function P404REDIRECT__filter_action_links( $links ) {
functions.php CHANGED
@@ -5,6 +5,55 @@ function P404REDIRECT_HideMsg()
5
  add_option( 'P404REDIRECT_upgrade_msg','hidemsg');
6
  }
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  function P404REDIRECT_after_plugin_row($plugin_file, $plugin_data, $status)
9
  {
10
  if(get_option('P404REDIRECT_upgrade_msg') !='hidemsg')
5
  add_option( 'P404REDIRECT_upgrade_msg','hidemsg');
6
  }
7
 
8
+ function P404REDIRECT_HideAlert()
9
+ {
10
+
11
+ update_option( 'P404_alert_msg','hidemsg');
12
+ }
13
+
14
+ function sample_admin_notice__error() {
15
+ $class = 'notice notice-error';
16
+ $links_count = P404REDIRECT_read_option_value('links',0);
17
+
18
+
19
+ if(get_option('P404_alert_msg')!='hidemsg' && $links_count>10)
20
+ {
21
+
22
+ $message = __( '<h3>All 404 Redirect to Homepage</h3><b>Warning</b>, You have many broken links <a href="'.admin_url( 'admin.php?page=all-404-redirect-to-homepage.php&mytab=404urls').'" style="color:red; font-wieght:bold">('.$links_count.')</a> that hurt your site\'s rank in search engines, <a target="_blank" href="https://www.wp-buy.com/product/seo-redirection-premium-wordpress-plugin/#fix404links">UPGRADE</a> your plugin and empower your site\'s SEO.&nbsp; <span id="Hide404Alert" style="cursor:pointer" ><a href="javascript:void(0)"><strong> Dismiss</strong></a> this message</span> or check the plugin <a href="'.admin_url( 'admin.php?page=all-404-redirect-to-homepage.php').'"><b>settings</b></a>.', 'sample-text-domain' );
23
+
24
+ printf( '<div id="all404upgradeMsg" class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), $message );
25
+
26
+
27
+ ?>
28
+ <script type="text/javascript">
29
+ jQuery(document).ready(function() {
30
+
31
+ jQuery("#Hide404Alert").click(function(){
32
+ jQuery.ajax({
33
+ type: 'POST',
34
+ url: '<?php echo admin_url();?>/admin-ajax.php',
35
+ data: {
36
+ action: 'P404REDIRECT_HideAlert'
37
+ },
38
+ success: function(data, textStatus, XMLHttpRequest){
39
+
40
+ jQuery("#all404upgradeMsg").hide();
41
+
42
+ },
43
+ error: function(MLHttpRequest, textStatus, errorThrown){
44
+ alert(errorThrown);
45
+ }
46
+ });
47
+ });
48
+
49
+ });
50
+ </script>
51
+
52
+ <?php
53
+ }
54
+ }
55
+ add_action( 'admin_notices', 'sample_admin_notice__error' );
56
+
57
  function P404REDIRECT_after_plugin_row($plugin_file, $plugin_data, $status)
58
  {
59
  if(get_option('P404REDIRECT_upgrade_msg') !='hidemsg')
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: wp-buy, osama.esh
3
  Tags: 404 error, redirection, homepage, broken images, redirection, https, automatic redirection, 404 link,redirect, soft 404, redirected, 301 seo redirect, post redirect plugin, broken links, fix 404
4
  Requires at least: 3.5
5
- Tested up to: 5.9.2
6
- Stable tag: 3.5
7
 
8
  By using this smart plugin, you can fix all 404 error links by redirecting them to homepage using the SEO 301 redirection. Improve your visibility in search engines now..
9
 
@@ -34,6 +34,11 @@ Extract the zip file and just drop the contents in the wp-content/plugins/ direc
34
 
35
  == Changelog ==
36
 
 
 
 
 
 
37
  = 3.5 =
38
  * Bug fixing - PHP 8.1 issue
39
 
2
  Contributors: wp-buy, osama.esh
3
  Tags: 404 error, redirection, homepage, broken images, redirection, https, automatic redirection, 404 link,redirect, soft 404, redirected, 301 seo redirect, post redirect plugin, broken links, fix 404
4
  Requires at least: 3.5
5
+ Tested up to: 6.0
6
+ Stable tag: 3.6
7
 
8
  By using this smart plugin, you can fix all 404 error links by redirecting them to homepage using the SEO 301 redirection. Improve your visibility in search engines now..
9
 
34
 
35
  == Changelog ==
36
 
37
+ = 3.6 =
38
+ * show alert message if you have many broken links
39
+ * compatibility check with wordpress 6.0
40
+
41
+
42
  = 3.5 =
43
  * Bug fixing - PHP 8.1 issue
44