Mailing List Subscription URL not using WP base page slug
Environment: CiviCRM 5.29.0, WordPress 5.4.2, PHP 7.3.20.
This issue started happening after an update of CiviCRM from 5.19 to 5.29: When subscribing to a mailing list, the confirmation link is missing a part, namely the WordPress CiviCRM base page slug. The link is supposed to be:
and instead it is:
That is, it is missing the /civicrm part (which is the base page slug) after the domain name. This seems to lead to the CiviCRM Smarty template not being properly loaded. If I manually insert the /civicrm part in the link, then the template is loaded correctly.
The WordPress base page is correctly selected in Administer > System Settings > CMS Database Integration. The /civicrm part seems to be correctly appearing in the URL in other situations - in the links for tracking opens, tracking clicks, unsubscribing.
The piece of code generating the confirmation link seems to be in /civicrm/CRM/Mailing/Event/BAO/Subscribe.php, line 216:
$url = CRM_Utils_System::url('civicrm/mailing/confirm',
"reset=1&cid={$this->contact_id}&sid={$this->id}&h={$this->hash}",
TRUE, NULL, TRUE, TRUE
);
I don't know if this code is taking into consideration the WordPress base page or not, or if the page's slug is supposed to be added to the URL here or in some other place.
Any help appreciated. :)