Skip to content

PHP Hooks & Filters (Actions & Filters) ​

QoraCRM provides rich WordPress extension points via standard add_action and add_filter. You can use these hooks in your custom plugins or child theme functions.php.


Actions ​

qoracrm_lead_created ​

Fires immediately after a new lead is successfully stored in the database. Triggered across all lead creation channels: native QoraCRM forms, third-party form integrations (CF7, WPForms, Elementor, etc.), manual creation via CRM admin, and API webhooks.

php
/**
 * @param int   $lead_id    The database ID of the created lead.
 * @param int   $form_id    The form ID (or 0 for manual/webhook leads).
 * @param array $entry_data Associative array of submitted field data.
 */
add_action( 'qoracrm_lead_created', function( $lead_id, $form_id, $entry_data ) {
    // Example: send lead data to custom third-party ERP/CRM
    error_log( "New lead #{$lead_id} created for form #{$form_id}!" );
}, 10, 3 );

qoracrm_lead_deleted ​

Fires after a lead is deleted from the CRM.

php
/**
 * @param int $lead_id The ID of the deleted lead.
 */
add_action( 'qoracrm_lead_deleted', function( $lead_id ) {
    // Custom cleanup logic
}, 10, 1 );

qoracrm_leads_batch_deleted ​

Fires when multiple leads are deleted simultaneously via bulk action.

php
/**
 * @param int[] $lead_ids Array of deleted lead IDs.
 */
add_action( 'qoracrm_leads_batch_deleted', function( $lead_ids ) {
    // Batch cleanup logic
}, 10, 1 );

qoracrm_save_settings ​

Fires whenever plugin settings are updated via REST API.

php
/**
 * @param array $params           Submitted settings data.
 * @param array $current_settings Existing settings before update.
 */
add_action( 'qoracrm_save_settings', function( $params, $current_settings ) {
    // Custom post-settings save logic
}, 10, 2 );

Filters ​

qoracrm_form_render_fields ​

Allows dynamically altering, reordering, adding, or removing form fields before the form HTML is rendered on the page.

php
/**
 * @param array $fields  List of field definitions in the form.
 * @param int   $form_id The form ID being rendered.
 * @return array
 */
add_filter( 'qoracrm_form_render_fields', function( $fields, $form_id ) {
    // Dynamically inject or modify fields
    return $fields;
}, 10, 2 );

qoracrm_leads_response ​

Filters the array of leads retrieved from the database before returning the REST API response.

php
/**
 * @param array $leads Array of lead objects.
 * @return array
 */
add_filter( 'qoracrm_leads_response', function( $leads ) {
    // Format or mask sensitive lead fields
    return $leads;
} );

qoracrm_lead_response ​

Filters a single lead object before returning via REST API.

php
/**
 * @param array $lead Single lead data array.
 * @return array
 */
add_filter( 'qoracrm_lead_response', function( $lead ) {
    return $lead;
} );

qoracrm_user_has_crm_access ​

Allows granting CRM access to specific users, user roles, or capabilities beyond standard administrators (manage_options).

php
/**
 * @param bool $has_access Default access flag.
 * @param int  $user_id    Current WordPress user ID.
 * @return bool
 */
add_filter( 'qoracrm_user_has_crm_access', function( $has_access, $user_id ) {
    $user = get_userdata( $user_id );
    if ( $user && in_array( 'sales_manager', (array) $user->roles, true ) ) {
        return true;
    }
    return $has_access;
}, 10, 2 );

qoracrm_allowed_statuses ​

Filters the list of valid lead statuses accepted during lead submission and updates.

php
/**
 * @param string[] $allowed_statuses Array of status slugs.
 * @return string[]
 */
add_filter( 'qoracrm_allowed_statuses', function( $allowed_statuses ) {
    $allowed_statuses[] = 'in_review';
    return $allowed_statuses;
} );

Released under GPL-2.0+ License.