@prefix sioc: <http://rdfs.org/sioc/ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix content: <http://purl.org/rss/1.0/modules/content/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<https://lhero.org/portfolio/lh-membership/>
  a sioc:Post ;
  dc:title "Background jobs" ;
  dcterms:identifier 155377 ;
  dc:modified "2026-11-22T16:26:48Z"^^xsd:dateTime ;
  dc:created "2026-11-22T16:26:48Z"^^xsd:dateTime ;
  sioc:link <https://lhero.org/portfolio/lh-membership/background-jobs/> ;
  sioc:has_creator <https://lhero.org/author/1/#account> ;
  sioc:has_container <https://lhero.org/#posts> ;
  content:encoded "<ul class=\"lh_portfolio-meta\"><li><strong>Part of:</strong> <a href=\"https://lhero.org/portfolio/lh-membership/\">LH Membership</a></li></ul><p class=\"wp-block-paragraph\">LH Membership runs its background work on Action Scheduler where a site has it, falling back to WP-Cron, following the LocalHero background-jobs convention. One class, <code>LH_Membership_queue_class</code> (<code>includes/lh-membership-queue-class.php</code>), owns every scheduling and unscheduling call in the plugin; nothing else calls <code>wp_schedule_*</code> or <code>as_*</code> directly.</p><h2 class=\"wp-block-heading\">The jobs</h2><ul class=\"wp-block-list\"><li><strong>Initial run</strong> (<code>lh_membership_initial_run</code>): one-off, queued on every site when the plugin is activated; creates the user and organisation consent terms and runs the post-status gates&#8217; first-time setup.</li><li><strong>Ongoing run</strong> (<code>lh_membership_ongoing_run</code>): hourly on every site; cleans up expired one-time codes.</li><li><strong>Invitation reminders</strong> (<code>lh_membership_org_invite_reminders</code>): hourly on every site where reminders are on (see Reminders for unfinished applications).</li><li><strong>Club address uses backfill</strong> (<code>lh_membership_address_uses_backfill</code>): one-off batches on the main site, each queuing the next until done; never a second batch while one is waiting.</li></ul><h2 class=\"wp-block-heading\">How they are scheduled</h2><ul class=\"wp-block-list\"><li>Action Scheduler is used only when its functions are loaded on the site, after <code>action_scheduler_init</code>, and never while switched to another site, since its tables belong to the site that is running. Actions go in the <code>lh-membership</code> group, listed under Tools &gt; Scheduled Actions.</li><li>Recurring jobs are created by a self-healing check on <code>init</code> (priority 30), at most once an hour per job per site (a transient per job), so a lost job comes back on its own and nothing needs scheduling on activation. Scheduling on Action Scheduler also clears any WP-Cron copy, so only one runner fires.</li><li>The WP-Cron fallback uses core&#8217;s <code>hourly</code> schedule.</li><li>Deactivation removes the plugin&#8217;s jobs from both runners (on each site, WP-Cron only while switched).</li></ul><h2 class=\"wp-block-heading\">Filters</h2><ul class=\"wp-block-list\"><li><code>lh_membership_uses_action_scheduler</code> ( bool ): return false to keep a site on WP-Cron.</li><li>Hook names: <code>lh_membership_initial_run_hook</code>, <code>lh_membership_ongoing_run_hook</code>, <code>lh_membership_org_invite_reminders_hook</code>, <code>lh_membership_address_uses_backfill_hook</code>.</li><li><code>lh_membership_ongoing_run_interval</code> (seconds, default one hour) and <code>lh_membership_scheduled_hooks</code> (the hooks removed on deactivation).</li></ul><p class=\"wp-block-paragraph\">(Since 2.119.0; before that every job was on WP-Cron directly.)</p>"^^rdf:XMLLiteral ;
  sioc:content "Part of: LH MembershipLH Membership runs its background work on Action Scheduler where a site has it, falling back to WP-Cron, following the LocalHero background-jobs convention. One class, LH_Membership_queue_class (includes/lh-membership-queue-class.php), owns every scheduling and unscheduling call in the plugin; nothing else calls wp_schedule_* or as_* directly.The jobsInitial run (lh_membership_initial_run): one-off, queued on every site when the plugin is activated; creates the user and organisation consent terms and runs the post-status gates&#8217; first-time setup.Ongoing run (lh_membership_ongoing_run): hourly on every site; cleans up expired one-time codes.Invitation reminders (lh_membership_org_invite_reminders): hourly on every site where reminders are on (see Reminders for unfinished applications).Club address uses backfill (lh_membership_address_uses_backfill): one-off batches on the main site, each queuing the next until done; never a second batch while one is waiting.How they are scheduledAction Scheduler is used only when its functions are loaded on the site, after action_scheduler_init, and never while switched to another site, since its tables belong to the site that is running. Actions go in the lh-membership group, listed under Tools &gt; Scheduled Actions.Recurring jobs are created by a self-healing check on init (priority 30), at most once an hour per job per site (a transient per job), so a lost job comes back on its own and nothing needs scheduling on activation. Scheduling on Action Scheduler also clears any WP-Cron copy, so only one runner fires.The WP-Cron fallback uses core&#8217;s hourly schedule.Deactivation removes the plugin&#8217;s jobs from both runners (on each site, WP-Cron only while switched).Filterslh_membership_uses_action_scheduler ( bool ): return false to keep a site on WP-Cron.Hook names: lh_membership_initial_run_hook, lh_membership_ongoing_run_hook, lh_membership_org_invite_reminders_hook, lh_membership_address_uses_backfill_hook.lh_membership_ongoing_run_interval (seconds, default one hour) and lh_membership_scheduled_hooks (the hooks removed on deactivation).(Since 2.119.0; before that every job was on WP-Cron directly.)" ;
  sioc:topic <https://lhero.org/?taxonomy=author&term=cap-1>, <https://lhero.org/?taxonomy=lh_object_key&term=lh-portfolio_doc_20261122t053000-lh-membership-background-jobs> .

<https://lhero.org/author/1/#account> rdfs:seeAlso <https://lhero.org/author/1/?feed=lhrdf&format=turtle> .
<https://lhero.org/?taxonomy=author&term=cap-1> rdfs:seeAlso <https://lhero.org/?taxonomy=author&term=cap-1&feed=lhrdf&format=turtle> .
<https://lhero.org/?taxonomy=lh_object_key&term=lh-portfolio_doc_20261122t053000-lh-membership-background-jobs> rdfs:seeAlso <https://lhero.org/?taxonomy=lh_object_key&term=lh-portfolio_doc_20261122t053000-lh-membership-background-jobs&feed=lhrdf&format=turtle> .
