我正在开发一个WP插件,用于在带有短代码的wordpress页面中运行的应用程序。该插件似乎运行正常但在控制台中我看到以下错误:
https://www.MyWebsiteRoot.zzz/WPFolder/MyPluginFolder/wp-includes/js/jquery/jquery.js?ver=1.11.3
Failed to load resource: the server responded with a status of 404 (Not Found)
https://www.MyWebsiteRoot.zzz/WPFolder/MyPluginFolder/wp-includes/js/jquery/ui/datepicker.min.js?ver=1.11.4
Failed to load resource: the server responded with a status of 404 (Not Found)
https://www.MyWebsiteRoot.zzz/WPFolder/MyPluginFolder/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1
Failed to load resource: the server responded with a status of 404 (Not Found)
https://www.MyWebsiteRoot.zzz/WPFolder/MyPluginFolder/wp-includes/js/jquery/ui/mouse.min.js?ver=1.11.4
Failed to load resource: the server responded with a status of 404 (Not Found)
https://www.MyWebsiteRoot.zzz/WPFolder/MyPluginFolder/wp-includes/js/jquery/ui/core.min.js?ver=1.11.4
Failed to load resource: the server responded with a status of 404 (Not Found)
https://www.MyWebsiteRoot.zzz/WPFolder/MyPluginFolder/wp-includes/js/jquery/ui/widget.min.js?ver=1.11.4
Failed to load resource: the server responded with a status of 404 (Not Found)
https://www.MyWebsiteRoot.zzz/WPFolder/MyPluginFolder/wp-includes/js/jquery/ui/button.min.js?ver=1.11.4
Failed to load resource: the server responded with a status of 404 (Not Found)
https://www.MyWebsiteRoot.zzz/WPFolder/MyPluginFolder/wp-includes/js/jquery/ui/slider.min.js?ver=1.11.4
Failed to load resource: the server responded with a status of 404 (Not Found)
https://www.MyWebsiteRoot.zzz/WPFolder/MyPluginFolderjs/wp-emoji-release.min.js?ver=4.4.1
Failed to load resource: the server responded with a status of 404 (Not Found)
https://www.MyWebsiteRoot.zzz/WPFolder/MyPluginFolder/wp-includes/js/wp-embed.min.js?ver=4.4.1
Failed to load resource: the server responded with a status of 404 (Not Found)
https://www.MyWebsiteRoot.zzz/WPFolder/MyPluginFolder/wp-includes/js/jquery/ui/spinner.min.js?ver=1.11.4
Failed to load resource: the server responded with a status of 404 (Not Found)
tinynav.js?ver=4.4.1:91 Uncaught TypeError: jQuery(...).tinyNav is not a function
看来基本路径在某些时候会混淆。 MyPluginFolder不应包含在字符串中。我不确定这是从哪里开始的。我不知道如何纠正它。我假设它是由我的插件启动的,因为它使用MyPluginFolder作为基本路径。我正在寻找有关如何排除故障并纠正此问题的提示。
这是我在插件中路径的代码:
/** Base Plugin Path */
define('EAWP_BASEPATH', __DIR__);
/** Supported Versions */
define('EAWP_MIN_VERSION', '1.0');
define('EAWP_MAX_VERSION', '1.0');
/** Setup Autoloader */
require EAWP_BASEPATH . '/core/Autoload.php';
$loader = new EAWP\Core\Autoload;
$loader->register();
$loader->addNamespace('EAWP\Core', EAWP_BASEPATH . '/core');
$loader->addNamespace('EAWP\Core\Interfaces', EAWP_BASEPATH . '/core/interfaces');
$loader->addNamespace('EAWP\Core\Exceptions', EAWP_BASEPATH . '/core/exceptions');
$loader->addNamespace('EAWP\Core\ValueObjects', EAWP_BASEPATH . '/core/value-objects');
$loader->addNamespace('EAWP\Libraries', EAWP_BASEPATH . '/libraries');
/** Initialize Plugin */
global $wpdb;
$route = new EAWP\Core\Route();
$plugin = new EAWP\Core\Plugin($wpdb, $route);
$plugin->initialize();
if(!function_exists('wp_get_current_user')) {
include(ABSPATH . "wp-includes/pluggable.php");
}