Skip to content
JS Filters

lzb.components.PreviewServerCallback.allowFetch

Filter called in editor preview before fetching new block content. Use this action to conditionally disable fetching.

Attributes

NameTypeDescription
allowBooleanallow fetching flag
dataObjectcomponent data

Usage

JS
wp.hooks.addFilter(
  "lzb.components.PreviewServerCallback.allowFetch",
  "my.custom.namespace",
  function (allow, data) {
    console.log(allow, data);
 
    const maybePreventFetch = true;
 
    if (maybePreventFetch) {
      return false;
    }
 
    return allow;
  }
);

Was this article helpful?