PHP Fatal error: Uncaught Error: Call to undefined function wp()

This issue is due to some core files in wordpress being corrupt.

The solution to this issue is to download new version of wordpress and upload new files and folders mentioned below

wp-includes , wp-admin and below files

wp-activate.php
wp-blog-header.php
wp-comments-post.php
wp-config.php
wp-config-sample.php
wp-cron.php
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-settings.php
wp-signup.php
wp-trackback.php
xmlrpc.php

This resolved the issue and wordpres site was working fine