Hello, I just migrated content of our site built on GeneratePress with GP Premium plugin to a production environment and noticed a problem: In administration on generatepress dashboard, there are missing styles and JS files, the problem seems to be that there is a trailing slash inside GP_PREMIUM_DIR_URL constant defined in gp-premium.php :
define( ‘GP_PREMIUM_DIR_URL’, plugin_dir_url( __FILE__ ) );
According to WP docs, https://developer.wordpress.org/reference/functions/plugin_dir_url/
the plugin_dir_url returns url containing a trailing slash.
Next, this constant is used in class-dashboard.php to enqueue scripts for the dashboard:
wp_enqueue_script(
‘generate-pro-dashboard’,
GP_PREMIUM_DIR_URL . ‘/dist/dashboard.js’,
array(),
GP_PREMIUM_VERSION,
true
);
(Which, i think should be without the / before dist : GP_PREMIUM_DIR_URL . ‘dist/dashboard.js’ )
which results, in our case, in trying to load dashboard.js file from the following url: https://oursite.com/wp-content/plugins/gp-premium//dist/dashboard.js?ver=2.1.1
This url contains double slashes before dist folder, which i suspect might not be a problem in most cases, however our hosting environment is set up such that this returns a 404.
Is this a correct behaviour? Am I missing something?
Thank you for your help!