I am creating a simple 404 redirect plugin. I want the theme 404.php file to be override when I activate the plugin. There is a 404.php page in the plugin files. File path: plugins/myplugin/files/404.php
How to override 404.php file in theme files with 404.php in plugin folder (When I activate the plugin).
I just created the plugin and activated it. All codes are here:
function my_redicert_plugin() {
global $wpdb;
$table_namex = $wpdb->prefix . 'redirect_p';
$charset_collatex = $wpdb->get_charset_collate();
$sqlx = "CREATE TABLE $table_namex (
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
`mytext` longtext NOT NULL,
`okbutton` longtext NOT NULL,
UNIQUE KEY id (id)
);";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sqlx );
}
register_activation_hook( __FILE__, 'my_redicert_plugin' );
add_action('admin_menu', 'ds_menux');
function ds_menux() {
add_menu_page('404 Redirect', '404 Redirect', 'administrator', 'my-redirect-plugin', 'my_r_plugin', 'dashicons-admin-generic');
}
(Sorry my English.)