Uncaught Error: Call to a member function get_page_permastruct()

Here’s the stack trace:

[20-Sep-2022 10:03:31 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get_page_permastruct() on null in /home/xxxxxx/public_html/wp-includes/link-template.php:430
Stack trace:
#0 /home/xxxxxx/public_html/wp-includes/link-template.php(392): _get_page_link(Object(WP_Post), false, false)
#1 /home/xxxxxx/public_html/wp-content/plugins/download-manager/src/User/Login.php(308): get_page_link(Object(WP_Post))
#2 /home/xxxxxx/public_html/wp-includes/class-wp-hook.php(307): WPDM\User\Login->loginURL('https://www.edu...', '', false)
#3 /home/xxxxxx/public_html/wp-includes/plugin.php(191): WP_Hook->apply_filters('https://www.edu...', Array)
#4 /home/xxxxxx/public_html/wp-includes/general-template.php(459): apply_filters('login_url', 'https://www.edu...', '', false)
#5 /home/xxxxxx/public_html/wp-content/plugins/wordpress-seo/wp-seo-main.php(402): wp_login_url()
#6 /home/xxxxxx/public_html/wp-content/plugins/wordpress-seo/wp-seo.php(50): require_once('/home/xxxx...')
#7 /home/educ in /home/xxxxxx/public_html/wp-includes/link-template.php on line 430
  • This reply was modified 5 hours, 18 minutes ago by s_t_harvey.

I am also getting the same issue with a theme plugin that alters the login url via filters and actions. My previous post regarding this was marked as spam for some unknown reason but anyway here is my stack trace


2022-09-20 10:36:48.012815 [NOTICE] [9005] [T0] [2.58.28.32:12346-H3:0BE416C6D61668A8-8#APVH_dev.domain.com:443] [STDERR] PHP Fatal error:  Uncaught Error: Call to a member function get_page_permastruct() on null in /home/domain.com/dev.domain.com/wp-includes/link-template.php:430
Stack trace:
#0 /home/domain.com/dev.domain.com/wp-includes/link-template.php(392): _get_page_link()
#1 /home/domain.com/dev.domain.com/wp-includes/link-template.php(197): get_page_link()
#2 /home/domain.com/dev.domain.com/wp-content/plugins/play-block/inc/class-play-user-profile.php(506): get_permalink()
#3 /home/domain.com/dev.domain.com/wp-includes/class-wp-hook.php(307): Play_User_Profile->login_url()
#4 /home/domain.com/dev.domain.com/wp-includes/plugin.php(191): WP_Hook->apply_filters()
#5 /home/domain.com/dev.domain.com/wp-includes/general-template.php(459): apply_filters()
#6 /home/domain.com/dev.domain.com/wp-content/plugins/wordpress-seo/wp-seo-main.php(402): wp_login_url()
#7 /home/domain.com/dev.domain.com/wp-content/plugins/wordpress-seo/wp-seo.php(50): require_once('/ in /home/domain.com/dev.domain.com/wp-includes/link-template.php on line 430

I have narrowed the issue down to this code in wp-seo-main.php line 399


$is_login_page = false;
if ( isset( $_SERVER['SCRIPT_NAME'] ) ) {
	$script_name = sanitize_text_field( wp_unslash( $_SERVER['SCRIPT_NAME'] ) );
	if ( strlen( $script_name ) > 0 && stripos( wp_login_url(), $script_name ) !== false ) {
		$is_login_page = true;
	}
}

When I comment this code out in my staging site, everything starts working again so this is obviously something to do with customisations on login pages etc.

This part of the Yoast code is totally unhookable/unfilterable so there is no way to skip/alter this check if your code has a custom login configuration like mine does. I hope someone from the Yoast team can help with this!

Hello,

Thanks for your reply.

Yes, you are correct, my site uses WordPress Download Manager Pro plugin which induces custom login configuration.

I’ll make the changes you suggest but hopefully this can be looked at by Yoast for the next update.

Hey @slr1979 & @s_t_harvey,

Thank you both for reaching out to us about this!

We’re already checking the error stacks to see what is going on. It seems that in certain setups like yours where the login page URL is modified or the wp_login_url() function returns an invalid path, we are not handling it properly.

To be able to investigate this more properly, can you please do a conflict check to see what combination of plugins/theme causes it so we can try to reproduce the errors.

Thank you!

Thanks Jeroen

I appreciate you looking into this so quickly.

I can confirm that this is occurring for me with a combination of Yoast SEO and WordPress Download Manager Pro.

Thanks

Thanks Jeroen

I also appreciate you looking into this so quickly.

I have created github issue Uncaught Error: Call to a member function get_page_permastruct() when using a custom login url and can confirm this is occurring with a combination of Yoast SEO and the Play Block plugin of the Waveme Theme (Themeforest).

Thanks

Thank you @slr1979, we’re looking into it as we speak!

Hey @s_t_harvey,

Thank you for your patience!

We’ve released 19.7.1 with a fix, can you please update and let us know if that works for you? Thanks!

That was fast! Yes working great. Thanks a lot 🙂

  • This reply was modified 1 hour, 20 minutes ago by s_t_harvey.

Thanks for letting us know – I’ll mark the topic as resolved.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer