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

更换WordPress主题后插件触发致命错误求助

Hey there, let's figure out this fatal error and get your booking plugin back up and running quickly!

What the error actually means

The error Fatal error: Cannot declare class wp_booking_calendar_public_setting, because the name is already in use tells us that the PHP class named wp_booking_calendar_public_setting has already been loaded somewhere on your site, and now the WP Booking Calendar plugin is trying to declare the same class again. PHP doesn't allow duplicate class names, so it throws this error to stop the site from breaking further.

Since this started happening right after you switched to your new theme, the most likely culprit is a code conflict between your new theme and the plugin.

Step-by-step solutions

Let's walk through the fixes from easiest to more involved:

1. Check your new theme for duplicate class names

First, search your theme's files for the string wp_booking_calendar_public_setting:

  • Use an FTP client to access your theme folder (wp-content/themes/your-new-theme/), or use the Theme Editor in WordPress (if you have access) to search across all theme files.
  • If you find this class defined in your theme, that's the conflict. Here's how to fix it:
    • If you built the theme yourself: Rename the class to something unique (add your theme's prefix to avoid future conflicts), e.g., soccerclub_wp_booking_calendar_public_setting. Don't forget to update every place in the theme where this class is referenced.
    • If it's a third-party theme: Reach out to the theme developer immediately to report this conflict—they'll need to fix the duplicate class name in their code.

2. Temporary quick fix (for urgent use)

If you need the booking plugin working right now, you can temporarily disable the conflicting class in your theme:

  • Find the file in your theme that defines wp_booking_calendar_public_setting, then comment out the entire class using PHP comments:
    /*
    class wp_booking_calendar_public_setting {
        // All the theme's class code here
    }
    */
    

This lets the plugin's version of the class load normally. Note: This is a band-aid—you'll want to implement a proper fix (like renaming the class) long-term to avoid other issues.

3. Check if your theme is loading the plugin's file

Sometimes themes accidentally load plugin files directly. Check your theme's functions.php or other core files for lines that reference wp-content/plugins/wp-booking-calendar/public/class/settings.class.php. If you find such a line, delete it—this is causing the plugin's class to load twice.

4. Update everything

It's possible this conflict is a known issue that's been fixed in newer versions:

  • Update the WP Booking Calendar plugin to the latest version.
  • Update your new theme to its latest release.
    After updating, test the booking page again to see if the error is gone.

5. Rule out plugin-specific issues

To confirm it's definitely the theme causing the conflict:

  • Temporarily switch to a default WordPress theme (like Twenty Twenty-Four).
  • If the booking plugin works with the default theme, the problem is 100% your new theme.
  • If it still throws the error, try reinstalling the plugin:
    1. Backup your booking plugin's settings (use the plugin's export feature, or backup your site's database).
    2. Uninstall WP Booking Calendar, then download and install the latest version from the WordPress plugin repository.

内容的提问来源于stack exchange,提问作者Romain De Paepe

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.08 20:47:47