Tuesday, October 18, 2022
HomeWordPress DevelopmentHook or perform to test if performing a WP Core replace?

Hook or perform to test if performing a WP Core replace?


I am looking for a strategy to detect if WP is actively performing a core replace.

The use-case is a growth server the place I break issues frequently and coded two “emergency reset” procedures that may reset the positioning again to a working state by both including URL question args to the positioning URL (if WP is not completely damaged), or visiting a particular ‘reset.php’ web site hyperlink (WP completely damaged). The URL question args technique makes use of WP features to make modifications. The ‘reset.php’ executes sh scripts to make modifications.

A part of what occurs throughout a reset is disabling all plugins. To verify particular plugins are energetic always (together with after a reset), I am hooking into 'plugins_loaded' and force-activating particular plugins. Kinda like MU Plugins, however forcibly activated each web page load, and they are often deleted if want be.

The issue is that each web page load of WP, the 'plugins_loaded' hook is acted upon, making particular plugins always activated, which breaks WP Core updates giving the message "An automatic WordPress replace has failed to finish".

I am searching for a hook or perform to detect when WP is performing a Core replace in order that I can selectively force-activate plugins solely when a Core replace is NOT actively taking place.

One thing like is_doing_core_update() returns true or false.

No luck discovering one thing like this myself, so reaching out to the gurus.

ALTERNATIVE METHOD
If I’m unable to discover a appropriate strategy to accomplish this, my various choice is to test for updates to core & plugins after which do any obtainable updates PRIOR to force-activating these particular plugins. Possibly that is my solely actual choice, however I might nonetheless prefer to see if there is a hook or perform to detect when an replace is actively taking place.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments