Sensei: Only enqueue user-dashboard.js on pages that use it

Created on 4 Nov 2019  路  3Comments  路  Source: Automattic/sensei

This JS file is loaded on every page of the website. Can you please dequeue it everywhere but on the User Dashboard page?

Performance [Pri] Normal [Status] Accepted [Type] Bug

All 3 comments

This also pulls in additional jQuery-related deps, bloating JS payload even further:

Footer | jquery-ui-tabs | wp-includes/js/jquery/ui/tabs.min.js | jquery-ui-core, jquery-ui-widget | sensei-user-dashboard | 1.11.4

I'd be interested in taking this on as a first issue -- I was thinking to use the is_page("my-courses") method call to only enqueue that file on the user dashboard (in class-sensei-frontend.php), but that seems brittle, since admin users can change the name / slug of the "My Courses" page.

Are there other approaches I should take a look at, or other ways you might recommend to limit the enqueuing?

Find out the option value that My Courses page can be configured with and compare against that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kraftbj picture kraftbj  路  4Comments

donnapep picture donnapep  路  5Comments

donnapep picture donnapep  路  3Comments

Protohominid picture Protohominid  路  6Comments

merkushin picture merkushin  路  3Comments