1. Home
  2. Knowledge Base
  3. Developer Documentation
  4. Thrive Themes Action Hooks & Custom Functions

Thrive Themes Action Hooks & Custom Functions

Thrive Themes products come with a set of helpful hooks that allow developers to extend functionality, modify data, and trigger custom logic during specific events.


1. Action Hooks

Actions provide a way to run a function at a specific point in the execution of WordPress Core, plugins, and themes.

Implementation Example

function custom_logic_after_campaign_start($data) {
    // Add your custom logic here
}
add_action('thrive_ultimatum_evergreen_campaign_start', 'custom_logic_after_campaign_start');

Supported Products & Key Hooks

ProductHook IDDescription
Thrive Dashboardthrive_core_user_loginFired when a user logs in.
Thrive Architectthrive_core_lead_signupFired when a lead is captured via a Lead Generation form.
Thrive Apprenticethrive_apprentice_lesson_completedFired when a student completes a lesson.
Thrive Ultimatumthrive_ultimatum_campaign_startFired when a campaign starts for a user.

2. Filter Hooks

Filters allow you to intercept and modify data before it is processed or displayed.

The tha_social_meta filter allows you to modify the Open Graph and Twitter metadata generated by your theme.

Filter Definition:

$meta = apply_filters('tha_social_meta', $meta);

Usage Example:
Add this to your child theme’s functions.php to override the og:url data:

add_filter("tha_social_meta", "modify_og_url");

function modify_og_url($meta) {
    $url = 'https://yourcustomurl.com';
    $meta['og:url']['content'] = $url;
    return $meta;
}

Metadata Structure:
The $meta array contains unique IDs for each tag, allowing for precise overrides of og:type, og:url, twitter:card, and more.


3. Parameter Reference

When hooking into Thrive events, the following data objects are commonly passed to your functions:

  • User Data: Includes WP_User object, Username, and Email.
  • Form Data: Raw data submitted through Lead Generation or Contact Forms.
  • Apprentice Data: Lesson IDs, Course IDs, and Module structures.
  • Campaign Data: Thrive Ultimatum campaign IDs and settings.

4. Best Practices

  • Use Child Themes: Always add custom hooks to a child theme’s functions.php or a site-specific plugin to prevent changes from being lost during updates.
  • Prefix Functions: Prefix your function names (e.g., tt_ or yourprefix_) to avoid conflicts with WordPress core or other plugins.
  • Reference GitHub: For more advanced hook examples, visit our Developer GitHub Repository.
Was this article helpful?

Related Articles

>