Update deprecated references e.g. WP_PLUGIN_URL ==> plugins_url()
-
Hi Plugin Developers,
1) Many thanks for creating this plugin
2) For compatibility with TLS sites / WordPress MU / Content-Security-Policy
… would it be possible to update the plugin code to use:
plugins_url()
plugin_dir_url()
plugin_dir_path()
plugin_basename()
… instead of WP_PLUGIN_URL & WP_PLUGIN_DIR ?e.g.
$ svn diff Index: _modules/dashboard/dashboard.php =================================================================== --- _modules/dashboard/dashboard.php (revision 1210780) +++ _modules/dashboard/dashboard.php (working copy) @@ -11,7 +11,6 @@ function __construct($plugin) { // Plugin Details $this->dashboard = $plugin; - $this->dashboardURL = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)); // Hooks add_action('admin_enqueue_scripts', array(&$this, 'adminScriptsAndCSS')); @@ -26,7 +25,7 @@ // CSS // This will only enqueue once, despite this hook being called by up to several plugins, // as we have set a single, distinct name - wp_enqueue_style('wpbeginner', $this->dashboardURL.'css/admin.css'); + wp_enqueue_style('wpbeginner', plugins_url('css/admin.css', __FILE__ )); } /** @@ -58,4 +57,4 @@ } } } -?> \ No newline at end of file +?>More info in these links:
https://ww.wp.xz.cn/ideas/topic/wp_plugin_url-doesnt-take-ssl-into-account
https://codex.ww.wp.xz.cn/Determining_Plugin_and_Content_DirectoriesKind regards,
JJ
The topic ‘Update deprecated references e.g. WP_PLUGIN_URL ==> plugins_url()’ is closed to new replies.