Permalink error generated while using SwitchTo plugin to test accounts
While using the SwitchTo plugin to test out contacts on the site, when switching back to the admin account, the following error is generated.
PHP Fatal error: Uncaught Error: Call to a member function get_page_permastruct() on null in /public_html/wp-includes/link-template.php:430
Stack trace:
#0 /public_html/wp-includes/link-template.php(392): _get_page_link(Object(WP_Post), false, false)
#1 /public_html/wp-includes/link-template.php(197): get_page_link(Object(WP_Post), false, false)
#2 /public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php(79): get_permalink(Object(WP_Post))
#3 [internal function]: CRM_Utils_System_WordPress->{closure}()
#4 /public_html/wp-content/plugins/civicrm/civicrm/Civi/Core/Paths.php(130): call_user_func(Object(Closure))
#5 /public_html/wp-content/plugins/civicrm/civicrm/Civi/Core/Paths.php(256): Civi\Core\Paths->getVariable('wp.frontend', 'url')
#6 /public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php(432): Civi\Core\Paths->getUrl('.', 'relative')
#7 /public_html/w in /public_html/wp-includes/link-template.php on line 430`
Reloading the page, the error isn't generated again. It is just when clicking the link to switch back to the original user account. This was working before without any issues.