Hooks reference: actions
8 min read
All hooks are named wpmcf/{area}/{event}. This page lists the actions (things that happened, or places to add something). Filters are on Hooks reference: filters.
- Plan tells which build fires the hook. Free hooks are in every build. Pro hooks exist only in builds that contain Pro code and fire only on a licensed or trial site (their features are described in the plans).
- Arguments are listed in order. Always declare the number of arguments you use:
add_action( 'wpmcf/...', $callback, 10, 2 ). - A listener that throws is caught by the plugin's fault guard for plugin-owned listeners only. Write your own callbacks defensively: an exception in a callback of yours can interrupt the request that fired the hook.
- Actions that exist for registration (
register_pages,variables/register,field_types/register...) fire once per request when the registry is first used. Attach your listener early (when your plugin file loads, or onplugins_loaded).
Lifecycle
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Free |
| After every module has registered and booted (on |
| Free | none | On plugin activation, after the database schema and settings are set up. |
| Free | none | On plugin deactivation, after scheduled actions are removed and rewrite rules flushed. |
add_action( 'wpmcf/booted', function () {
// wpmcf_get_field() and the other functions are ready from here.
} );Variables
wpmcf/variables/register
Plan | Free |
Arguments |
|
Fires | Once, when the variable registry is first built after boot (or at |
Use | Add namespaces, filters and functions. |
add_action( 'wpmcf/variables/register', function ( $registry ) {
$registry->registerFilter( 'shout', fn ( $v ) => strtoupper( (string) $v ) . '!' );
} );Full example: PHP API. A listener attached after the registry was built never runs; register on wpmcf_variable_registry() directly instead.
Admin screens
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Free |
| While the plugin builds its admin menu. Add a screen with |
| Free |
| After a plugin screen's script has been enqueued and |
| Free |
| On each request of the header search ( |
| Free |
| When the Settings screen data is built. |
add_action( 'wpmcf/admin/enqueue_page', function ( $page ) {
if ( $page->id === 'settings' ) {
wp_enqueue_script( 'my-settings-tab', plugins_url( 'tab.js', __FILE__ ), [ 'wp-hooks' ], '1.0', true );
}
} );Database
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Free |
| After one migration's |
| Free |
| After a migration's |
Field types, field groups and fields
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Free |
| When the field type registry loads (first use in a request), after the built-in types. |
| Free |
| After a field group definition is saved or deleted. |
| Free | none | Once per request, when code-registered field groups are collected. Call |
| Free |
| Listened to by the plugin, not fired by it. Fire it from a duplicate-post tool to copy the field rows of one post to another. |
// After your plugin duplicates a post:
do_action( 'wpmcf/fields/copy_object', $original_id, $copy_id );Post types, taxonomies and options pages
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Free |
| Just before a stored post type is passed to |
| Free |
| Right after it was registered. |
| Free |
| After a post type definition is saved or deleted. |
| Free |
| Just before |
| Free |
| Right after it was registered. |
| Free |
| After a taxonomy definition is saved or deleted. |
| Free |
| After an options page definition is saved or deleted. |
| Free |
| After values on an options page were stored: on the options page screen (when at least one group saved) and by |
add_action( 'wpmcf/post_types/after_register', function ( $name, $definition ) {
if ( $name === 'book' ) {
add_post_type_support( 'book', 'page-attributes' );
}
}, 10, 2 );Global Data
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Free |
| After Global Data was saved on its screen or with |
Page cache purging
The plugin purges the page caches of WP Rocket, LiteSpeed Cache, W3 Total Cache, WP Super Cache, WP Fastest Cache, SiteGround Optimizer, Breeze and WP Engine after content it controls changes. You can feed that mechanism or follow it.
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Free (also fired by Pro) |
| Listened to by the plugin, and fired by Programmatic SEO when generated pages change. Fire it to purge URLs; with an empty list or no argument everything is purged. Calls are collected and sent once at the end of the request. |
| Free (also fired by Pro) |
| Listened to by the plugin; fired after a value of a post is written with |
| Free |
| After the page caches were asked to purge. |
do_action( 'wpmcf/cache/purge', [ home_url( '/pricing/' ) ] ); // one URL
do_action( 'wpmcf/cache/purge' ); // everythingTurn the whole mechanism off with the wpmcf/cache/enabled filter or the Settings option.
Background tasks
Tasks are the plugin's background jobs (imports, schema changes, Pro generation runs). Each fires after it happens; none of them changes the outcome.
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Free |
| When a task finished all its batches. |
| Free |
| When a task failed for good (out of retry attempts). |
| Free |
| After a task was deleted, even in the middle of a run. A handler removes what the run left behind (files, working tables). |
Admin columns
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Free |
| After field columns were added to a list table. |
Page builders
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Free |
| The first time the builder component registry is used. |
Forms (Pro)
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Pro |
| After a front-end form stored its entry and sent its notification. |
| Pro |
| After a submission of another form plugin (Gravity Forms, Contact Form 7, WPForms, Fluent Forms) was stored in a data table through a connection. |
add_action( 'wpmcf/forms/submitted', function ( $form, $object_id, $kind ) {
if ( $kind === 'entry' ) {
wp_mail( get_option( 'admin_email' ), 'New entry', 'Row ' . $object_id );
}
}, 10, 3 );Data tables (Pro)
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Pro |
| After a row was inserted or updated. |
| Pro |
| After rows were deleted. |
| Pro |
| After a CSV import or a feed sync finished. |
| Pro |
| After a data source and its table were deleted. Modules drop what they stored for it (for example its feed). |
Programmatic SEO (Pro)
Hook | Plan | Arguments | Fires |
|---|---|---|---|
| Pro |
| A generation run completed. |
| Pro |
| Generated pages changed outside a run (status, hand edits, a source row, AI text). |
| Pro |
| All generated pages of a task were removed because the task was reset or its identity changed. |
| Pro |
| A task and its pages were deleted. |
| Pro |
| A generated page became a regular post. |
| Pro |
| A generated page is being served (status 200 sent). The multilingual module switches language here. |
add_action( 'wpmcf/pseo/page_converted', function ( $post_id, $page_id ) {
update_post_meta( $post_id, '_converted_from_pseo', $page_id );
}, 10, 2 );Internal scheduled actions
These are Action Scheduler hooks the plugin schedules for its own batches (group wpmcf). They are listed so you recognize them in Tools › Scheduled Actions. Do not call or remove them.
Hook | Argument | Runs |
|---|---|---|
| task ID | One batch of a background task |
| none | Every 15 minutes: re-queues active tasks whose run was cut off |
| field group key | A large table change that runs in the background |
| none | Imports code-registered field groups when their hash changed |
| none | The ACF migration |
Not a hook, but related
wpmcf_fs_loaded is fired by the bootstrap after the Freemius licensing layer has loaded (do_action( 'wpmcf_fs_loaded' )). It uses an underscore, not a slash, because the licensing layer owns it.
Still stuck? Contact support