Hooks

Docs Hooks Free · PHP hooks

modal_kit_pro_listings

filter

Free

PHP

The Pro features listed in the free plugin’s screens and block. Pro removes each one it provides; an add-on can hide listings by key or area.

A listing is an entry for a Pro feature, marked PRO, that the free plugin shows where the feature would be: rows in a Button’s Action setting, Pro collections in the template picker, the Forms panel in the Modal sidebar, the audience rule in Display rules, the WooCommerce triggers (on sites with WooCommerce), the Style editor note in Modal Kit → Settings → Styles, and one notice on the modal list once three modals are live.

The free plugin contains no Pro code. Modal Kit Pro filters this list and removes the listing for each feature it provides, and its real control shows in that place.

Each user can dismiss a listing for themselves (Not now hides it for 30 days), and Modal Kit → Settings → Pro → Pro tips turns them all off for everyone. With Pro tips off, the filter isn’t called.

Parameters

Parameter

Description

$listings

array<int, array>

The listings. Each has a key and an area, plus the text and link for that area: most have title, description and url; Action rows also have a label, the picker’s has groups, samples and compare, and the WooCommerce one items.

Returns

array<int, array> The listings, cast to an array. Each one must keep its key: the list is then narrowed to one area and the current user’s dismissals are taken out.

Examples

Hide the listings your add-on replaces

If your plugin adds its own forms to modals, hide the Forms prompts by key, the way Pro hides its own.

PHP

add_filter( 'modal_kit_pro_listings', function ( $listings ) {
  $replaced = array( 'submit-form', 'forms-panel' );

  return array_values(
    array_filter(
      (array) $listings,
      function ( $listing ) use ( $replaced ) {
        return ! in_array( $listing['key'] ?? '', $replaced, true );
      }
    )
  );
} );

Show listings to Administrators only

The filter runs for the current user, so other roles can get an empty list.

PHP

add_filter( 'modal_kit_pro_listings', function ( $listings ) {
  return current_user_can( 'manage_options' ) ? $listings : array();
} );

Leave out one area

For a client site with its own curated starters, this drops the Pro collections from the template picker and keeps the rest.

PHP

add_filter( 'modal_kit_pro_listings', function ( $listings ) {
  return array_values(
    array_filter(
      (array) $listings,
      function ( $listing ) {
        return 'picker' !== ( $listing['area'] ?? '' );
      }
    )
  );
} );

Good to know

Keys and areas: step-nav, go-to-step and submit-form (button-action); collections (picker); forms-panel (panel); audience-rules (rules); style-editor (styles); milestone (notice); and woo-triggers (trigger), only when WooCommerce is active.

Dismissals are stored per user in the modal_kit_dismissed user meta and applied after this filter.

The filter can run more than once in a request, and its result isn’t cached.

Applied in modal-kit/includes/Upsell.php.

Need a hook that isn’t here?