"dashboard"-named PHP file doesn't get included
I've made a simple test plugin to demonstrate the issue:
my-test-plugin/
├─ includes/
│ └─ dashboard.php
└─ main.php
?php // dashboard.php
echo 'h1Dashboard/h1';
?php // main.php
/**
* Plugin Name: My Test Plugin
*/
add_action('admin_menu', 'myTestPlugin_onAdminMenu');
function myTestPlugin_onAdminMenu() {
add_menu_page('My Dashboard', 'My Test Plugin', 'manage_options', 'my-test-plugin', 'myTestPlugin_displayDashboardPage');
}
function myTestPlugin_displayDashboardPage() {
require_once 'includes/dashboard.php';
}
This plugin only adds a menu item labeled My Test Plugin
, that displays the dashboard page. It works perfectly on my development Windows machine; but surprisingly, it doesn't work on my online web-hosting service (LiteSpeed Web server running PHP 7.3.25, Wordpress 5.6.2)!
When I change the name of dashboard.php
to anything else (e.g. dashboard1.php
), it works with no problems at all! What could be the problem here and how may I fix it?!
Topic filesystem dashboard plugin-development Wordpress
Category Web