AdminEase provides a comprehensive set of hooks and filters that allow developers to extend and customize the plugin's behavior. This reference documents all available extension points.

What are hooks and filters?

WordPress hooks are extension points that allow plugins to execute code at specific moments. There are two types: actions (do_action) allow you to add code that runs at a given point, and filters (apply_filters) allow you to modify data and return the changed version. AdminEase exposes hooks across its settings system, features, and bulk operations.

All hooks use the adminease_ prefix to avoid conflicts with other plugins. When adding hooks, follow this convention in your own code.

Settings and configuration hooks

adminease_settings_fields

Type: Filter | Priority: 10 (default)

When it runs: When AdminEase loads the settings interface in wp-admin. Used by every feature to register its UI fields.

Parameters:

  • $fields (array) — The entire settings field structure organized by tab and group.

Return value: Modified $fields array.

Use case: Add custom settings fields or modify existing ones. Each feature (e.g., DisableGutenberg, AutoLogoutUser) adds child fields to parent toggles using this hook.

add_filter( 'adminease_settings_fields', function( $fields ) {
    $fields['media']['fields'][] = [
        'type'  => 'switch',
        'id'    => 'my-custom-field',
        'name'  => 'adminease[media][my_custom_field]',
        'label' => 'My Custom Feature',
    ];
    return $fields;
} );
		

adminease_settings_saved

Type: Action | Priority: 10 (default)

When it runs: After AdminEase settings have been saved and sanitized, before the page redirects.

Parameters:

  • $sanitized_settings (array) — The complete validated settings array.

Use case: Perform side effects when settings change, such as writing .htaccess files, updating database flags, or clearing caches. The FileHandler and BlockSpecificCountries features use this to update server configuration.

add_action( 'adminease_settings_saved', function( $sanitized_settings ) {
    $block_countries = $sanitized_settings['security']['block_specific_countries'] ?? [];
    if ( ! empty( $block_countries ) ) {
        update_option( 'my_blocked_countries', $block_countries );
    }
} );
		

adminease_validate_settings

Type: Filter | Priority: 10 (default)

When it runs: During settings validation, before sanitized values are saved.

Parameters:

  • $sanitized_settings (array) — The already-sanitized settings.

Return value: Modified settings array with additional validation.

Use case: Add custom validation logic that depends on multiple settings or external state.

adminease_settings_subgroups

Type: Filter | Priority: 10 (default)

When it runs: When AdminEase organizes settings into visual groups within each tab.

Parameters:

  • $subgroups (array) — Array of subgroup definitions with labels and descriptions.

Return value: Modified $subgroups array.

Use case: Reorder or add visual sections in the settings UI.

Feature-specific hooks

adminease_auth_cookie_expiration

Type: Filter | Feature: Auto-logout User

When it runs: During authentication cookie setup. Allows modification of session timeout per user.

Parameters:

  • $timeout (int) — Default timeout in seconds.
  • $expiration (int) — Absolute expiration timestamp.
  • $user_id (int) — The user being authenticated.

Return value: Modified $timeout value.

Use case: Set different timeouts based on user role, IP address, or other conditions. Pro version uses this to implement role-based timeouts.

adminease_suppress_admin_notices

Type: Filter | Feature: Disable Admin Notices

When it runs: Before AdminEase suppresses WordPress admin notices.

Parameters:

  • $suppress (bool) — Whether to suppress notices.

Return value: Boolean indicating if suppression should occur.

Use case: Conditionally suppress notices based on context.

adminease_disable_comments_post_types

Type: Filter | Feature: Disable Comments

When it runs: When determining which post types should have comments disabled.

Parameters:

  • $post_types (array) — Default post types to disable comments on.

Return value: Modified post types array.

Use case: Exclude specific post types from comment disabling.

adminease_disable_gutenberg_post_types

Type: Filter | Feature: Disable Gutenberg (Pro)

When it runs: When determining which post types should use the classic editor.

Parameters:

  • $post_types (array) — Post types with Gutenberg disabled.

Return value: Modified post types array.

Use case: Programmatically control which post types use classic vs. block editor.

adminease_block_specific_countries_code

Type: Filter | Feature: Block Specific Countries (Pro)

When it runs: When generating .htaccess rules for country blocking.

Parameters:

  • $code (string) — Generated .htaccess rules.
  • $sanitized_settings (array) — Current settings.

Return value: Modified .htaccess code string.

Use case: Add whitelist rules, modify blocking logic, or integrate with third-party geolocation services.

Bulk operation hooks

adminease_bulk_delete_post_types_options

Type: Filter | Feature: Bulk Delete Posts

When it runs: When loading the list of post types available in the bulk delete interface.

Parameters:

  • $post_types (array) — Array of available post types.

Return value: Modified post types array.

adminease_bulk_delete_post_statuses_options

Type: Filter | Feature: Bulk Delete Posts

When it runs: When loading the list of post statuses available in the bulk delete interface.

Parameters:

  • $statuses (array) — Array of post statuses (publish, draft, trash, etc.).

Return value: Modified statuses array.

adminease_bulk_delete_preview_query_args

Type: Filter | Feature: Bulk Delete Posts

When it runs: When the bulk delete feature previews which posts will be deleted.

Parameters:

  • $query_args (array) — WP_Query arguments for the preview.

Return value: Modified query arguments.

Use case: Add meta_query, exclude specific posts, or modify the preview based on custom logic.

adminease_bulk_delete_query_args

Type: Filter | Feature: Bulk Delete Posts

When it runs: When executing the actual bulk delete operation for each batch of posts.

Parameters:

  • $query_args (array) — WP_Query arguments for deletion.

Return value: Modified query arguments.

Use case: Fine-tune which posts actually get deleted during bulk operations.

adminease_bulk_delete_batch_start

Type: Action | Feature: Bulk Delete Posts

When it runs: At the beginning of each batch deletion (50 posts per batch by default).

Parameters:

  • $posts (array) — Array of post objects being deleted.
  • $page (int) — Batch number.

Use case: Log deletions, send notifications, or perform pre-deletion checks.

adminease_bulk_delete_post

Type: Action | Feature: Bulk Delete Posts

When it runs: For each individual post deleted during bulk delete.

Parameters:

  • $post_id (int) — Post being deleted.
  • $post_type (string) — Post type.
  • $deletion_method (string) — Either 'trash' or 'delete'.

Use case: Track which posts are deleted, trigger cleanup routines, or update related data.

adminease_bulk_delete_batch_complete

Type: Action | Feature: Bulk Delete Posts

When it runs: After each batch of posts is deleted.

Parameters:

  • $deleted_count (int) — Number of posts deleted in this batch.
  • $page (int) — Batch number.

Use case: Update counters, send completion notifications, or manage resources.

UI customization hooks

adminease_global_inline_css

Type: Filter | Priority: 10 (default)

When it runs: When AdminEase enqueues its admin stylesheet.

Parameters:

  • $css (string) — Additional CSS to inject.

Return value: CSS string to add.

Use case: Add custom admin styles without creating a separate stylesheet.

adminease_dashboard_section_classes

Type: Filter | Priority: 10 (default)

When it runs: When rendering dashboard section containers.

Parameters:

  • $classes (string) — CSS classes for the section.

Return value: Modified classes string.

Use case: Add custom CSS classes for styling or JavaScript targeting.

Best practices

When using AdminEase hooks and filters, follow these guidelines:

Use proper priority numbers. Most hooks run at default priority (10). If you need to run before or after other callbacks, specify the priority as the third parameter: add_filter( 'adminease_settings_fields', 'my_callback', 20 ) runs after default priority callbacks.

Sanitize and validate data. Always sanitize input when modifying settings. Use WordPress functions like sanitize_text_field(), intval(), and wp_kses() to ensure security.

Use error handling. Wrap hook logic in try-catch blocks. If your code breaks settings saving or generates errors, it can break the entire admin interface.

Document your hooks. If you extend AdminEase in production code, document which hooks you're using and why. This helps with maintenance and debugging.

Check feature availability. Before hooking into feature-specific actions, verify the feature is enabled in AdminEase settings by checking Plugin::get_settings().

Example: Custom role-based session timeout

Here's a practical example combining multiple hooks to implement custom session timeout logic:

add_filter( 'adminease_auth_cookie_expiration', function( $timeout, $expiration, $user_id ) {
    $user = get_user_by( 'id', $user_id );

    if ( ! $user || empty( $user->roles ) ) {
        return $timeout;
    }

    // Custom: Editors get 10 minutes, everyone else gets the default
    if ( in_array( 'editor', $user->roles ) ) {
        return 10 * 60; // 10 minutes in seconds
    }

    return $timeout;
}, 10, 3 );