You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordPress 4.7(Ubuntu14)核心/插件/主题自动更新失效求助

Troubleshooting Automatic Updates for WordPress 4.7 on Ubuntu 14

Let’s work through the issues preventing your WordPress core, plugin, and theme automatic updates from working. I’ll start with the most common fixes first, since you’ve already tried several configurations:

1. Fix Your Filter Placement (Critical Mistake)

You added the auto_update_plugin and auto_update_theme filters to /wp-includes/functions.php—this is not a safe or permanent location. WordPress core files (like those in /wp-includes) get overwritten every time WordPress updates, so your custom filters will be erased. Worse, modifying core files can break WordPress functionality.

Move those filters to one of these safe locations instead:

  • Your active theme’s functions.php (located in /wp-content/themes/your-theme-name/)
  • A simple custom plugin (create a new file in /wp-content/plugins/ like custom-auto-updates.php with the following code, then activate it in your WP dashboard):
    <?php
    /*
    Plugin Name: Custom Auto Updates
    Description: Enables automatic plugin and theme updates
    Version: 1.0
    */
    add_filter( 'auto_update_plugin', '__return_true' );
    add_filter( 'auto_update_theme', '__return_true' );
    ?>
    

2. Resolve File Permission Issues (Ubuntu’s Most Common Pitfall)

WordPress needs write access to its files and directories to download and install updates. On Ubuntu, web servers (Apache/Nginx) typically run as the www-data user, which often doesn’t have proper ownership of WordPress files.

Run these commands in your terminal (replace /path/to/your/wordpress with your actual WordPress installation directory, e.g., /var/www/html):

# Set correct file ownership
sudo chown -R www-data:www-data /path/to/your/wordpress

# Set secure directory permissions
sudo find /path/to/your/wordpress -type d -exec chmod 755 {} \;

# Set secure file permissions
sudo find /path/to/your/wordpress -type f -exec chmod 644 {} \;

3. Disable Conflicting Update Plugins

You’re using three separate update management plugins: Easy Updates Manager, Companion Auto Update, and Simple Automatic Updates. These plugins all modify WordPress’ update behavior, and they’re almost certainly conflicting with each other and your core configuration.

Do this immediately:

  • Deactivate and delete all three plugins
  • Go to Dashboard → Updates and click "Check Again" to trigger a manual update check
  • Try running a manual update first (if an update is available) to confirm permissions and connectivity are working

4. Verify Your wp-config.php Settings

Double-check that your core update definitions are placed correctly in wp-config.php:

  • They must come before the line /* That's all, stop editing! Happy blogging. */—any code after this line won’t be executed
  • Your current settings are correct for full core updates, but confirm they look like this:
    define( 'AUTOMATIC_UPDATER_DISABLED', false );
    define( 'WP_AUTO_UPDATE_CORE', true );
    

5. Rule Out Other Plugin/Theme Interference

Security plugins (like Wordfence, iThemes Security) or custom themes often disable automatic updates as a "security" measure. Test this by:

  • Deactivating all non-essential plugins (leave only your custom auto-update plugin if you created one)
  • Switching to a default WordPress theme (e.g., Twenty Seventeen, which is compatible with WP 4.7)
  • Rechecking for updates in Dashboard → Updates

6. Check Server PHP and Network Configuration

WordPress needs to connect to WordPress.org to download updates. Verify these server settings:

  • allow_url_fopen: This PHP setting must be enabled. If you don’t have access to WP’s Site Health tool (WP 4.7 doesn’t include it), create a phpinfo.php file in your WordPress root with:
    <?php phpinfo(); ?>
    
    Access this file in your browser, search for allow_url_fopen, and ensure it’s set to "On". If not, edit your php.ini file and restart your web server.
  • Network Connectivity: Test if your server can reach WordPress.org by running this terminal command:
    curl https://api.wordpress.org/core/version-check/1.7/
    
    You should see a JSON response with version data. If you get an error, check your Ubuntu UFW firewall rules to ensure outbound traffic on ports 80/443 is allowed, or verify if your server uses a proxy that needs configuration.

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:41:50