Skip to main content

Enabling and disabling components

The OhMyEtch settings screen lets you turn whole component families (for example Carousel or Woo) and single components on and off. OhMyEtch stops creating and updating the components of a disabled family or a disabled component.

What disabling does by default​

When you disable a family or a component, OhMyEtch removes its data:

  • the generated component posts (wp_block posts named ome-component-…), and
  • its default styles in Etch, including styles you edited.

When you enable it again, OhMyEtch creates new component posts with new IDs and restores the default styles. Pages that already used the component point at the old post ID, so they do not pick up the new one.

Styles that another enabled family still uses are kept. For example, disabling Woo keeps the UIChoice styles that the map radius facet uses, including your edits.

Keep posts and styles when disabling​

Return false from the ome_component_disable_purge filter to keep the data of disabled families and components:

add_filter( 'ome_component_disable_purge', '__return_false' );

With the filter returning false:

  • Disabling keeps the component posts and their styles, including your edits.
  • Pages that already use a disabled component keep loading its CSS, so they render as before.
  • Enabling the family or component again reuses the same posts and IDs and keeps your edited styles.
  • The posts of disabled components stay in place, so they can still appear among your saved Etch components. OhMyEtch stops updating them until you enable them again.

Add the filter in a small plugin or your theme's functions.php, before you disable anything. Disabling a family while the filter is not active deletes its data as described above. If you remove the filter later, the kept posts and styles stay, but pages that use a component that is still disabled stop loading its CSS. Enable that component again, or keep the filter.

caution

Change component settings through the OhMyEtch settings screen only. Writing the oh_my_etch_component_settings option directly (for example with WP-CLI or SQL) is not supported: it skips the cleanup and sync steps, and the result can change between releases.