Skip to content

Fix fatal is_plugin_active() error in wp-admin on WordPress 6.7 and older - #1239

Merged
repile[bot] merged 1 commit into
developmentfrom
fix/1238-is-plugin-active-wp67
Oct 19, 2026
Merged

repile[bot] merged 1 commit into
developmentfrom
fix/1238-is-plugin-active-wp67

Conversation

@repile

@repile repile Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Description

On WordPress 6.7 and older, with Yoast SEO not active, every wp-admin screen fails with Call to undefined function is_plugin_active() in modules/yoastseo/yoastseo.php:120. This affects the released 2.29.0 and current development.

PPCH_Yoastseo::isYoastSEOActivated() and the Util::is*Activated() helpers call is_plugin_active() during init (LegacyPlugin::init, priority 1000). WordPress before 6.8 only loads wp-admin/includes/plugin.php for wp-admin after init. Until 2.29.0, Plugin::deactivateLegacyPlugin() ran on init at priority 10 and loaded that file as a side effect. Removing it in 4fee77b (#380) exposed the bug. WordPress 6.8+ loads the file in wp-settings.php, so it doesn't show there.

Changes:

  • Add Util::isPluginActive(), which loads wp-admin/includes/plugin.php when is_plugin_active() isn't available yet. This is the same guard LegacyPlugin::isBlockEditorActive() already uses.
  • Use it in all Util::is*Activated() helpers (Rank Math, AIOSEO, WooCommerce, Yoast SEO, ACF) and in LegacyPlugin::isClassicEditorInstalled().
  • PPCH_Yoastseo::isYoastSEOActivated() now calls Util::isYoastSeoActivated() instead of keeping its own copy.

Tested

Fresh SandyWP sandboxes, PHP 8.3, WP_DEBUG_LOG on.

Build WP 6.7, no Yoast WP 6.7 + Yoast 24.0 WP 7.1.3 + Yoast WP 7.1.3, no Yoast
2.28.0 works – – –
development @ 358d914 (= 2.29.0) fatal on every wp-admin screen works works works
This PR Dashboard, Checklists, Settings, block editor and front end all load ✅ Yoast tab and its 4 requirements load ✅ Yoast tab loads ✅ Checklists loads, no Yoast tab ✅

The PHP debug log had no plugin entries in any run with this PR.

Before (development, WP 6.7, no Yoast) After (this PR, WP 6.7, no Yoast)
before after

Recordings: before · after: Dashboard, Checklists, Settings, block editor, front end

Test site

Open a copy of the test site. Each click opens a fresh copy, signed in to wp-admin as admin.

  • It runs WordPress 6.7 with this PR, Yoast SEO installed but inactive: the setup that fatals on development/2.29.0.
  • You land on Checklists, which now loads. Also open Dashboard, Checklists → Settings and Posts → Add New; all load.
  • Optional: activate Yoast SEO under Plugins, go back to Checklists, and the Yoast SEO tab appears with its requirements.

Benefits

wp-admin works again on WordPress 5.5–6.7 (the plugin's declared minimum is 5.5) without depending on another plugin to load wp-admin/includes/plugin.php. Pro calls the same Util::is*Activated() helpers, so it is covered too.

Possible drawbacks

wp-admin/includes/plugin.php is now loaded during init on WordPress before 6.8 when one of these checks runs. WordPress 6.8+ already does this itself, and 2.28.0 and earlier did the same via deactivateLegacyPlugin().

Applicable issues

Fixes #1238

Checklist

  • I have created a specific branch for this pull request before committing, starting off the current HEAD of development branch.
  • I'm submitting to the development, feature/hotfix/release branch. (Do not submit to the master branch!)
  • This pull request relates to a specific problem (bug or improvement).
  • I have mentioned the issue number in the pull request description text.
  • All the issues mentioned in this pull request relate to the problem I'm trying to solve.
  • The code I'm sending follows the PSR-12 coding style.

🤖 Generated with Claude Code

…lder

The Yoast SEO module and the Util plugin-detection helpers call
is_plugin_active() during init. WordPress before 6.8 only loads
wp-admin/includes/plugin.php for wp-admin after init, so every admin
screen failed with "Call to undefined function is_plugin_active()" when
Yoast SEO was not active. Before 2.29.0, Plugin::deactivateLegacyPlugin()
loaded that file on init as a side effect; removing it exposed the bug.

Add Util::isPluginActive(), which loads wp-admin/includes/plugin.php when
needed, and use it in all plugin-detection helpers. The Yoast module now
uses Util::isYoastSeoActivated() instead of its own copy.

Fixes #1238

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@repile repile Bot added this to the 2.30 milestone Oct 14, 2026
@repile repile Bot added confirmed bug Free php Pull requests that update Php code labels Oct 14, 2026
@repile

repile Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Review: Safe to merge ✅

Code. The diff adds Util::isPluginActive(), which loads wp-admin/includes/plugin.php when is_plugin_active() isn't defined yet (the same guard isBlockEditorActive() already uses). All Util::is*Activated() helpers, isClassicEditorInstalled() and the Yoast module now go through it. The PR still merges cleanly into current development (ca670c5, 47 commits ahead of the PR base; only LegacyPlugin.php needed a trivial auto-merge). After the merge, every other is_plugin_active() call in the plugin (isBlockEditorActive(), checklists.php:1215, the instance-protection lib) is already guarded, so I found nothing else that can fatal on early init. Behaviour on WP 6.8+ is unchanged, because function_exists() is already true there.

Tests. Fresh SandyWP sandboxes (not cloned from any customer site), PHP 8.3, WP_DEBUG_LOG on. I tested development @ ca670c5 against development + this PR merged in. For the editor check I set "Number of characters in title" to Recommended (min 30).

Setup development This PR (merged into development)
WP 6.7, Yoast not active ❌ critical error on every wp-admin screen: Call to undefined function is_plugin_active() in modules/yoastseo/yoastseo.php:120 ✅ Dashboard, Checklists, Checklists → Settings, block editor (checklist shows in the pre-publish panel) and front end all load
WP 6.7 + Yoast SEO 24.0 active loads ✅ Yoast SEO tab and its requirements load; block editor checklist works
WP 7.1.3 + Yoast SEO 28.7 active – ✅ Yoast SEO tab loads; block editor checklist works
WP 7.1.3, Yoast not active – ✅ Dashboard, Checklists (no Yoast tab), Settings, block editor checklist work

The PHP debug log had no PHP notices, warnings or errors in any run with this PR. On development it had only the fatal above.

Evidence. These links need a Repile login, so the images can't be embedded here:

Unrelated, already on development: on WP 6.7 + Yoast 24.0, the Yoast icon in the Checklists tab list renders very large (screenshot). It looks the same with and without this PR and is fine on WP 7.1.3 + Yoast 28.7, so it doesn't block this PR. I'd track it separately.

Verdict: Safe to merge. It fixes the 2.29.0 fatal on WP 6.7 and older and shows no regressions on 6.7 or 7.1.3, with or without Yoast.

@repile
repile Bot merged commit 41611bb into development Oct 19, 2026
3 checks passed
@rizaardiyanto1412
rizaardiyanto1412 deleted the fix/1238-is-plugin-active-wp67 branch October 26, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

confirmed bug Free php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fatal error in wp-admin on WordPress 6.7 and older when Yoast SEO is not active (is_plugin_active undefined)

1 participant