You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

WordPress报错:wp-blog-header.php第16行调用未定义函数wp()如何修复?

Fixing "Call to undefined function wp()" in WordPress

Hey, I’ve run into this exact error a bunch of times—let’s break down why it’s happening and how to fix it quickly. The error means your WordPress site can’t find the wp() function, which lives in wp-includes/functions.php. This almost always happens because the wp-load.php file (which loads all core WordPress functions) isn’t being loaded correctly from wp-blog-header.php.

Here’s what you can do step by step:

1. Check if wp-load.php exists in your root directory

First, log into your server via FTP or your hosting control panel and head to your public_html folder. Verify that wp-load.php is present. If it’s missing:

  • Download the exact same version of WordPress you’re using from the official site.
  • Extract the zip file, grab the wp-load.php file, and upload it to your site’s root directory.

2. Fix the wp-load.php path in wp-blog-header.php

The line require_once( dirname(__FILE__) . '/wp-load.php' ); relies on relative paths, which can break if your file structure changed (e.g., moving to a subdirectory, or PHP version differences). Try replacing it with an absolute path instead:

require_once( '/home/your-username/public_html/wp-load.php' );

Make sure to replace /home/your-username/public_html/ with your actual server path to the root folder.

3. Verify file permissions

Incorrect permissions can prevent PHP from reading core files. Set these permissions using FTP or your hosting panel:

  • For wp-load.php and other core files: 644
  • For directories like wp-includes and wp-admin: 755
    Avoid setting permissions to 777—it’s a huge security risk.

4. Replace damaged core files

If wp-load.php or other core files are corrupted:

  • Download the matching WordPress version zip.
  • Extract it, then delete the wp-content folder from the extracted files (we don’t want to overwrite your themes/plugins).
  • Upload the remaining wp-admin, wp-includes folders, and all root files (except wp-config.php) to your server, overwriting the existing ones.

5. Rule out plugin/theme conflicts

Sometimes a bad plugin or theme can interfere with core file loading:

  • Rename your wp-content/plugins folder to plugins_old—this disables all plugins. If the site loads, rename folders one by one to find the culprit.
  • Rename your active theme folder (in wp-content/themes) to something like theme_old, then WordPress will fall back to a default theme (e.g., Twenty Twenty-Four). If this fixes it, your theme was the issue.

Important Note

Always back up your site (files and database) before making any changes—this way you can revert if something goes wrong.

内容的提问来源于stack exchange,提问作者naudi_alvarado

火山引擎 最新活动