Skip to content

Commit 9be5087

Browse files
committed
🐛 BUG: Fixed assets loading on pages outside of BenchPress specific pages
1 parent 684c857 commit 9be5087

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

benchpress.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,16 @@ function benchpress_render_settings_page() {
354354
* @since 1.0.0
355355
* @return void
356356
*/
357-
function benchpress_enqueue_assets() {
357+
function benchpress_enqueue_assets( $hook ) {
358+
// Bail early if we're not on BenchPress pages.
359+
if ( ! in_array( $hook, [
360+
'toplevel_page_benchpress',
361+
'benchpress_page_benchpress-snapshots',
362+
'benchpress_page_benchpress-settings'
363+
], true ) ) {
364+
return;
365+
}
366+
358367
wp_enqueue_style( 'benchpress-styles', plugin_dir_url( __FILE__ ) . 'assets/css/style.css', [], BENCHPRESS_VERSION );
359368
wp_enqueue_style( 'select2-css', plugin_dir_url( __FILE__ ) . 'assets/css/select2.min.css', [], BENCHPRESS_VERSION );
360369
wp_enqueue_script( 'select2-js', plugin_dir_url( __FILE__ ) . 'assets/js/select2.min.js', [ 'jquery' ], BENCHPRESS_VERSION, true );

0 commit comments

Comments
 (0)