Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to a member function get_page_permastruct() on a non-object (NULL) #27

Open
enricodeleo opened this issue Dec 18, 2015 · 0 comments

Comments

@enricodeleo
Copy link

Hi!
I just discovered that calling endpoints with the basic authentication generates randomly the error (fortunately the majority of calls don't generate any error)
BadMethodCallException: Call to a member function get_page_permastruct() on a non-object (NULL)
The stack trace points to /wp-includes/link-template.php(314): _get_page_link().

I'm using the v2 wp rest api plugins and seems that the origin of the error is when this plugin does wp_authenticate.

Any ideas about it?

UPDATE
The error is related to the wp_lostpassword_url function that is triggered during login. Apparently the function is called during the authentication process in order to return an url where the user could recover his own password. At this point WP isn't able to generate the permalink (may be it is too early). Does anyone know how to disable this call? I implemented a custom password recovery system by the way, so I will never need the build-in method.

BrianHenryIE added a commit to BrianHenryIE/Basic-Auth that referenced this issue Aug 9, 2017
Sometimes, with an incorrect username and password (or using email address rather than username, which made `wp_authenticate_username_password` error) when `$user = wp_authenticate( $username, $password );` errored, it would call `$wp_rewrite->get_page_permastruct();` before `$wp_rewrite` was initialized, returning a 500 server error. In my case, this would happen when I enabled the SkyVerge WooCommerce Print Invoices/Packing Lists plugin.
BrianHenryIE added a commit to BrianHenryIE/Basic-Auth that referenced this issue Aug 9, 2017
martin-rueegg added a commit to metaworx/Basic-Auth that referenced this issue Apr 14, 2020
Merge pull request #2 from BrianHenryIE/wp_authenticate-bugfix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant