Skip to main content

PHP hooks

Overview​

WPEnhanced Ajax Filter Blocks exposes WordPress apply_filters and do_action hooks during block rendering. Use these to adjust settings values, markup conditions, and Pro feature output without editing plugin core.

Hook names use the daf_ prefix (Divi Ajax Filter heritage). They are stable extension points for themes and companion plugins.

warning

Always test hooks on staging. Incorrect filters can break filter HTML or hide required controls.

Naming pattern​

daf_{block}_{context}_{setting}

Examples:

  • daf_filterposts_render_mobile_toggle — Filter Posts mobile toggle setting
  • daf_filter_posts_item_render_radio_appearance — Filter item radio/swatches appearance
  • daf_archiveloop_render_enable_load_more — Archive Loop load more (Pro)

Most filters receive ( $default, $value ) or ( $value, $attributes ). Check the second parameter in your hook callback—it is the value from block attributes.

Filter Posts block​

Common filters on Filter Posts render:

HookPurpose
daf_filterposts_render_scrollto_sectionScroll target section ID after filter
daf_filterposts_render_mobile_toggleMobile filter drawer on/off
daf_filterposts_render_appearancePanel appearance (normal, toggle, slide)
daf_filterposts_render_filter_param_containerSelected-filter chips container
daf_filterposts_render_synchronizeSync multiple filter panels

Condition filters (return boolean) control whether UI features render:

  • daf_filterposts_render_mobile_toggle_condition
  • daf_filterposts_render_appearance_toggle_condition
  • daf_filterposts_render_appearance_slide_condition

Actions:

  • daf_filterposts_render_mobile_toggle_js — Inject JS for mobile toggle button
  • daf_filterposts_render_toggle_js — Inject JS for toggle/slide appearance

Filter Posts Item block​

HookPurpose
daf_filter_posts_item_render_show_filter_parametersShow active filter chips for this item
daf_filter_posts_item_render_radio_appearanceRadio vs swatch appearance
daf_filter_posts_item_render_taxonomy_filter_typeTaxonomy control type override
daf_filter_posts_item_render_range_valuesPrice/range min/max source
daf_filter_posts_item_render_conditional_logicConditional filter rules (Pro)
daf_filter_posts_item_conditionalConditional settings array (Pro)
daf_filter_posts_item_styleInline CSS for swatch sizing

Pro render actions (require Pro active):

  • daf_filter_posts_item_render_acf_pro
  • daf_filter_posts_item_render_acf_map_pro
  • daf_filter_posts_item_render_posttypes_pro

Archive Loop block​

HookPurpose
daf_archiveloop_render_enable_load_moreLoad more / infinite scroll (Pro)
daf_archiveloop_render_display_typeList vs grid display (Pro)
daf_archiveloop_render_grid_styleGrid layout style

Example: force mobile toggle on​

add_filter( 'daf_filterposts_render_mobile_toggle', function ( $default, $value ) {
return 'on';
}, 10, 2 );

Example: adjust swatch appearance globally​

add_filter( 'daf_filter_posts_item_render_radio_appearance', function ( $default, $value ) {
if ( is_shop() ) {
return 'swatch';
}
return $value;
}, 10, 2 );

Query modification​

Block attribute hooks adjust rendered settings, not raw WP_Query in all cases. For deep query changes, prefer:

  • Archive Loop block query settings in the editor
  • Advanced loop queries (Pro) for complex base queries
  • Custom code targeting REST query endpoints (contact support for guidance on supported REST extension points in your version)

Best practices​

  1. Prefix your callback functions or use a singleton class.
  2. Use priority 10 unless you must run before/after other plugins.
  3. Return the original value when your condition does not apply.
  4. Do not echo from filter callbacks—return modified values; use actions for output.

What's next​