wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Uncaught Error: Call to a member function get_page_permastruct() when using a custom login url

Open slr1979 opened this issue 4 years ago • 3 comments

  • [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

slr1979 avatar Sep 20 '22 11:09 slr1979

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!

mmikhan avatar Sep 20 '22 12:09 mmikhan

@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!

mmikhan avatar Sep 20 '22 14:09 mmikhan

@iamazik Thank you so much for sorting this out so quickly. Much appreciated!

slr1979 avatar Sep 20 '22 16:09 slr1979