lite-site: skip module init when Newspack Lite Site plugin is active#4720
Merged
miguelpeixe merged 2 commits intoMay 13, 2026
Merged
Conversation
miguelpeixe
requested changes
May 13, 2026
Member
miguelpeixe
left a comment
There was a problem hiding this comment.
Thanks, @R1shabh-Gupta!
It's best to hook this under plugins_loaded to ensure the Lite Site plugin is loaded.
…nst standalone plugin
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prevents the built-in Lite Site module inside newspack-plugin from initializing when the standalone Newspack Lite Site plugin is active, avoiding collisions on shared identifiers (settings group/option name, menu slug, and rewrite rules).
Changes:
- Add an early
defined( 'NEWSPACK_LITE_SITE_PLUGIN_FILE' )guard insideLite_Site::init()to no-op when the standalone plugin is present. - Switch module bootstrapping from an immediate
Lite_Site::init();call to aplugins_loadedhook so the constant check reliably reflects other loaded plugins.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When the Newspack Lite Site plugin (code here) is active alongside
newspack-plugin, both register identical WordPress identifiers and the same settings group (newspack_lite_site), option name (newspack_lite_site_settings), admin menu slug (newspack-lite-site), and rewrite rules. This causes:sanitize_option_newspack_lite_site_settings.The standalone plugin defines
NEWSPACK_LITE_SITE_PLUGIN_FILEin its main file at load time. GuardingLite_Site::init()with a check for that constant prevents the built-in module from initializing at all when the standalone plugin is active, eliminating all four collision points.All Submissions:
Changes proposed in this Pull Request:
Wrap
Lite_Site::init()inincludes/lite-site/class-lite-site.phpwith adefined( 'NEWSPACK_LITE_SITE_PLUGIN_FILE' )guard so the built-in lite-site module is a no-op when the Newspack Lite Site plugin is active.How to test the changes in this Pull Request:
newspack-pluginand the Newspack Lite Site plugin.NEWSPACK_LITE_SITE_PLUGIN_FILEis undefined).Other information: