Uncaught Error: Call to a member function get_page_permastruct() when using a custom login url
- [x] I've read and understood the contribution guidelines.
- [x] I've searched for any related issues and avoided creating a duplicate issue.
Please give us a description of what happened.
When updating to 19.7, I encounter a fatal error. It appears that this is happening when customised login urls are used in plugins/themes. In my case, this is created by one of my theme plugin functions which is hooked into the wp native login_url filter
add_filter( 'login_url', array( $this, 'login_url' ), 10, 3 );
public function login_url( $login_url, $redirect, $force_reauth ) {
if ( $this->page_login ) {
$login_url = add_query_arg( 'action', 'login', get_permalink( $this->page_login ) );
if(!isset($_REQUEST['interim-login']) && $redirect){
$login_url = add_query_arg( 'redirect_to', $redirect, $login_url );
}
}
return apply_filters( 'play_login_url', $login_url, $redirect, $force_reauth );
}
I have narrowed the issue down to the code on line 399 in wp-seo-main.php where the login url check to prevent Yoast on the login page occurs. #18836
When commenting out this code, my site is accessible again. There is no way to bypass or alter this check as there are no available filters or actions. As many themes/plugins alter the login url, this does/could affect other users too. Please see Uncaught Error: Call to a member function get_page_permastruct()
Used versions
- WordPress version: 6.0.2
- Yoast SEO version: 19.7
- Relevant plugins in case of a bug: Waveme - Play Block - also WordPress Download Manager Pro.
- Tested with theme: Waveme
Thank you for bringing this to our attention. We are so sorry that you are affected by this unexpected bug. We are working on a patch release and will available as quickly as possible!
@slr1979 the patch release is available now for everyone https://wordpress.org/plugins/wordpress-seo/. Please, update the plugin to the latest version and that shall fix the issue for you!
@iamazik Thank you so much for sorting this out so quickly. Much appreciated!