Fatal error: Uncaught Error: Call to a member function get_page_permastruct() on null in C:\xampp\htdocs\TwizoAdminTFA\wp-includes\link-template.php:357
The code that causes it:
if(!$this->page_exists_by_slug('twizo-verification')){
$newPage = array(
'post_title' => '2FA Settings',
'post_name' => 'twizo-verification',
'post_type' => 'page',
'post_status' => 'publish'
);
wp_insert_post($newPage);
}
public function page_exists_by_slug($page_slug) {
$page = get_page_by_path( $page_slug , OBJECT );
if ( isset($page) )
return true;
else
return false;
}
I found out that $wp_rewrite is null in link-template.php, but I don’t know why.
]]>