User Dashboard shortcode doesn't addCoreResources
When using a shortcode for a profile (and possibly for contribution pages and events), CiviCRM somehow uses Civi::resources()->addCoreResources()
to load civicrm js and style files. However, the shortcode for user dashboard ([civicrm component="user-dashboard" hijack="0"]
) does not.
BTW, there is documentation for invoking Civi::resources()->addCoreResources()
in an extension to load these files, but this method doesn't seem to work in WordPress (see https://civicrm.stackexchange.com/q/2475/907 and bug reports referenced in comments there.)
As a result, the only way I've found to get these files into the wordpress front-end (even on a page that includes User Dashboard by shortcode) is to manually invoke CRM_Core_Resources::singleton()->addScriptFile()
and ...->addStyleFile()
for each resource, which seem clumsy and prone to breaking in upgrades.
It seems like all civicrm shortcodes should include these core resources on the WP page.
- My CMS: WordPress 5.5.3
- My CiviCRM: 5.35.1