Skip to content

Docs: cron deactivation cleanup is overstated for bundled installs #177

Closed

Description

@vinnysgreen

Summary

The cron docs state unconditionally that scheduled jobs are cleaned up on deactivation. That is only true when Blockstudio is installed as its own plugin. Bundled inside another plugin (or a theme) via Composer, there is no deactivation event for Blockstudio, so the jobs stay scheduled.

Current behavior / evidence

The cron page says, in its intro, in “How it works” step 6, and again in the Deactivation section, that all Blockstudio cron events are unscheduled on plugin deactivation.

In code, cleanup is:

register_deactivation_hook( __FILE__, array( 'Blockstudio\\Cron', 'unschedule_all' ) );

in blockstudio.php. That hook fires only when blockstudio.php itself is deactivated. The wp bs teardown command's own docblock states it plainly: only the plugin case has a deactivation hook, so a Composer consumer has no lifecycle event that could unschedule cron jobs.

Correction to an earlier reading of this issue

The cron page does now mention teardown: its Deactivation section says a Composer installation inside a theme or another plugin has no deactivation hook of its own, so removing it leaves the events scheduled, and to run wp bs teardown before removing Blockstudio. That section was updated Oct 14, 2026. This issue is therefore not “the page never mentions teardown” — it's that the unconditional statements at the top of the page still contradict the caveat buried below.

What should change

  1. Qualify the intro and “How it works” step 6: cleanup on deactivation applies to the standalone-plugin install only.
  2. Clarify that the gap is not just “removal” — deactivating the host plugin, or switching away from a theme that bundles Blockstudio, also leaves the events scheduled, and wp bs teardown has to run before the code is gone, because the wp bs command goes with it.
  3. Document the host-side cleanup path: e.g. a host plugin calling Cron::unschedule_all() from its own deactivation hook, or a supported helper for that, so bundled users have something to do besides remembering a manual CLI step.

Impact

Orphaned recurring events persist in the cron array. After Blockstudio is removed they have no callback to run; if it is reinstalled, schedule_all() sees the existing event and does not reschedule, so the old job can silently resume. At minimum, the docs should not promise cleanup that does not happen.


Activity

  1. dnnsjsk commented on Oct 24, 2026

    @dnnsjsk
    Contributor

    The documentation correction is included in Blockstudio 7.7.8. It now distinguishes standalone plugin deactivation from bundled installations, explains when to run wp bs teardown, and gives host-plugin and theme cleanup hooks. This corrects the documentation rather than changing cron's runtime behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions