Subscribe to Our Mailing List and Stay Up-to-Date!
Subscribe
LaunchPad API reference - code documentation showing hooks, filters, and action examples with parameters and usage
Developer Resources

LaunchPad API Reference: Hooks, Filters, and Actions Guide

LaunchPad provides extensibility through WordPress hooks, filters, and actions allowing developers to customize behavior without modifying core plugin files. Whether you’re creating custom recipes, integrating with third-party plugins, or building client-specific functionality, understanding the LaunchPad API reference is essential for clean, update-safe customization.

LaunchPad API reference - code documentation showing hooks, filters, and action examples with parameters and usage

Many developers modify plugin files directly, creating maintenance nightmares when updates overwrite customizations. The proper approach uses documented APIs that survive updates while enabling powerful customization. According to WordPress developer best practices, 92% of plugin conflicts stem from direct file modifications rather than using provided hooks.

This comprehensive LaunchPad API reference documents all available hooks, filters, and actions including recipe system filters, wizard workflow actions, branding and content hooks, REST API endpoints, theme integration points, and complete code examples. Use this reference guide to extend LaunchPad systematically and maintainably.

Filter Hooks Reference

Filters allow modifying data before LaunchPad processes it. Return modified values from filter callbacks.

launchpad_custom_recipes

Purpose: Add custom recipes to LaunchPad recipe selection.

Parameters:

  • $recipes (array): Existing recipes array

Returns: Modified recipes array

Example:

add_filter('launchpad_custom_recipes', 'add_custom_recipes');

function add_custom_recipes($recipes) {
    $custom_recipe = array(
        'site_type' => 'medical',
        'name' => 'Medical Practice',
        'description' => 'Website for medical practices and healthcare',
        'icon' => 'dashicons-heart',
        'category' => 'business',
        'pro_only' => false,
        'pages' => array('home', 'services', 'about', 'contact')
    );

    $recipes[] = $custom_recipe;
    return $recipes;
}

launchpad_recipe_data

Purpose: Modify recipe data before processing during site build.

Parameters:

  • $recipe_data (array): Recipe configuration data
  • $recipe_slug (string): Recipe identifier

Returns: Modified recipe data array

Example:

add_filter('launchpad_recipe_data', 'customize_recipe_plugins', 10, 2);

function customize_recipe_plugins($recipe_data, $recipe_slug) {
    if ($recipe_slug === 'business') {
        // Add additional plugin for business recipe
        $recipe_data['plugins'][] = 'custom-business-plugin';
    }
    return $recipe_data;
}

launchpad_page_content

Purpose: Customize generated page content before creation.

Parameters:

  • $content (string): Page content HTML
  • $page_slug (string): Page identifier
  • $recipe_slug (string): Recipe being used
  • $branding_data (array): User-provided branding information

Returns: Modified content string

Example:

add_filter('launchpad_page_content', 'customize_about_page', 10, 4);

function customize_about_page($content, $page_slug, $recipe_slug, $branding_data) {
    if ($page_slug === 'about') {
        $company_name = isset($branding_data['site_name'])
            ? $branding_data['site_name']
            : 'Our Company';

        $custom_content = '<h2>About ' . esc_html($company_name) . '</h2>';
        $custom_content .= '<p>Custom about content here...</p>';
        $custom_content .= $content; // Append original content

        return $custom_content;
    }
    return $content;
}

launchpad_plugin_list

Purpose: Modify recommended plugin list before display/installation.

Parameters:

  • $plugins (array): Plugin slugs array
  • $recipe_slug (string): Current recipe

Returns: Modified plugins array

Example:

add_filter('launchpad_plugin_list', 'add_required_plugins', 10, 2);

function add_required_plugins($plugins, $recipe_slug) {
    // Add security plugin to all recipes
    if (!in_array('wordfence', $plugins)) {
        $plugins[] = 'wordfence';
    }
    return $plugins;
}

launchpad_theme_options

Purpose: Modify theme Customizer settings applied during setup.

Parameters:

  • $options (array): Theme options array
  • $recipe_slug (string): Current recipe

Returns: Modified options array

Example:

add_filter('launchpad_theme_options', 'customize_theme_colors', 10, 2);

function customize_theme_colors($options, $recipe_slug) {
    if ($recipe_slug === 'portfolio') {
        $options['primary_color'] = '#FF6B6B';
        $options['secondary_color'] = '#4ECDC4';
    }
    return $options;
}

launchpad_branding_css

Purpose: Modify CSS generated from branding choices.

Parameters:

  • $css (string): Generated CSS code
  • $branding_data (array): Branding configuration

Returns: Modified CSS string

Example:

add_filter('launchpad_branding_css', 'add_custom_branding_css', 10, 2);

function add_custom_branding_css($css, $branding_data) {
    $custom_css = "
    .custom-element {
        background-color: {$branding_data['primary_color']};
    }
    ";
    return $css . $custom_css;
}

Action Hooks Reference

Actions allow executing code at specific points in LaunchPad execution. Don’t return values from action callbacks.

launchpad_before_recipe_build

Purpose: Execute code before recipe site generation begins.

Parameters:

  • $recipe_slug (string): Recipe being built
  • $branding_data (array): User-provided branding data

Example:

add_action('launchpad_before_recipe_build', 'prepare_custom_setup', 10, 2);

function prepare_custom_setup($recipe_slug, $branding_data) {
    // Log build start
    error_log("Building site with recipe: {$recipe_slug}");

    // Set up custom options
    update_option('custom_setup_timestamp', time());

    // Prepare any resources needed
}

launchpad_after_recipe_build

Purpose: Execute code after recipe site generation completes.

Parameters:

  • $recipe_slug (string): Recipe that was built
  • $branding_data (array): Branding data used

Example:

add_action('launchpad_after_recipe_build', 'post_build_setup', 10, 2);

function post_build_setup($recipe_slug, $branding_data) {
    // Create custom post type content
    if ($recipe_slug === 'portfolio') {
        create_sample_portfolio_items();
    }

    // Send notification
    wp_mail(
        get_option('admin_email'),
        'Site Build Complete',
        "Your {$recipe_slug} site has been created successfully."
    );

    // Clear any caches
    if (function_exists('wp_cache_flush')) {
        wp_cache_flush();
    }
}

launchpad_page_created

Purpose: Execute code after individual page creation.

Parameters:

  • $page_id (int): Created page ID
  • $page_slug (string): Page slug/identifier
  • $recipe_slug (string): Current recipe

Example:

add_action('launchpad_page_created', 'customize_page_meta', 10, 3);

function customize_page_meta($page_id, $page_slug, $recipe_slug) {
    // Add custom meta to specific pages
    if ($page_slug === 'contact') {
        update_post_meta($page_id, '_contact_form_id', '123');
    }

    // Set page template
    if ($page_slug === 'home') {
        update_post_meta($page_id, '_wp_page_template', 'template-homepage.php');
    }
}

launchpad_plugin_installed

Purpose: Execute code after each plugin installation.

Parameters:

  • $plugin_slug (string): Installed plugin slug
  • $plugin_status (bool): Installation success status

Example:

add_action('launchpad_plugin_installed', 'configure_plugin', 10, 2);

function configure_plugin($plugin_slug, $plugin_status) {
    if (!$plugin_status) {
        return; // Installation failed
    }

    // Configure specific plugins after installation
    switch ($plugin_slug) {
        case 'wordpress-seo':
            // Configure Yoast SEO
            update_option('wpseo_titles', array(
                'separator' => 'sc-dash'
            ));
            break;

        case 'contact-form-7':
            // Create default contact form
            create_default_contact_form();
            break;
    }
}

launchpad_theme_activated

Purpose: Execute code after theme activation during build.

Parameters:

  • $theme_slug (string): Activated theme slug

Example:

add_action('launchpad_theme_activated', 'configure_theme', 10, 1);

function configure_theme($theme_slug) {
    if ($theme_slug === 'launchpad-bundle') {
        // Set theme mods
        set_theme_mod('header_layout', 'centered');
        set_theme_mod('footer_widgets', 3);
    }
}

launchpad_branding_applied

Purpose: Execute code after branding application.

Parameters:

  • $branding_data (array): Applied branding configuration

Example:

add_action('launchpad_branding_applied', 'finalize_branding', 10, 1);

function finalize_branding($branding_data) {
    // Generate custom CSS file
    $css = generate_custom_css($branding_data);
    file_put_contents(
        get_stylesheet_directory() . '/custom-branding.css',
        $css
    );
}

REST API Endpoints Reference

LaunchPad exposes REST API endpoints for wizard functionality. Useful for custom integrations.

GET /wp-json/launchpad/v1/recipes

Purpose: Retrieve available recipes list.

Response:

{
  "success": true,
  "data": [
    {
      "site_type": "blog",
      "name": "Blog / News Site",
      "description": "...",
      "icon": "dashicons-admin-post"
    }
  ]
}

POST /wp-json/launchpad/v1/wizard/build

Purpose: Trigger site build with recipe.

Request Body:

{
  "recipe": "business",
  "branding": {
    "site_name": "My Business",
    "primary_color": "#2563EB"
  }
}

Response:

{
  "success": true,
  "message": "Site built successfully",
  "data": {
    "pages_created": 5,
    "plugins_installed": 3
  }
}

POST /wp-json/launchpad/v1/wizard/reset

Purpose: Reset/remove LaunchPad-created content.

Response:

{
  "success": true,
  "message": "Site reset successfully"
}

Helper Functions Reference

LaunchPad provides utility functions for common tasks.

LaunchPad\Utils\Helpers::is_pro_active()

Purpose: Check if Pro version is active.

Returns: bool

Example:

if (\LaunchPad\Utils\Helpers::is_pro_active()) {
    // Pro-only functionality
}

LaunchPad\Utils\Helpers::get_recipe($slug)

Purpose: Retrieve recipe data by slug.

Parameters:

  • $slug (string): Recipe identifier

Returns: array|false Recipe data or false if not found

Example:

$recipe = \LaunchPad\Utils\Helpers::get_recipe('business');
if ($recipe) {
    echo $recipe['name']; // "Business Site"
}

LaunchPad\Utils\Logger::log($message, $type, $data)

Purpose: Add entry to LaunchPad activity log.

Parameters:

  • $message (string): Log message
  • $type (string): Log type (info, error, warning, success)
  • $data (array): Additional context data

Example:

\LaunchPad\Utils\Logger::log(
    'Custom recipe deployed',
    'success',
    array('recipe' => 'medical', 'pages' => 5)
);

Best Practices for LaunchPad API Reference Usage

Follow these guidelines when using the LaunchPad API.

Use Specific Hook Priorities

Control execution order with priorities:

// Run before other hooks (priority 5)
add_action('launchpad_after_recipe_build', 'early_setup', 5, 2);

// Run after other hooks (priority 20)
add_action('launchpad_after_recipe_build', 'late_setup', 20, 2);

Always Return Filtered Values

Filters must return values:

// CORRECT
add_filter('launchpad_plugin_list', function($plugins) {
    $plugins[] = 'new-plugin';
    return $plugins; // Must return
});

// WRONG - doesn't return
add_filter('launchpad_plugin_list', function($plugins) {
    $plugins[] = 'new-plugin';
    // Missing return!
});

Check Conditions Before Acting

Verify context before executing:

add_action('launchpad_page_created', 'my_function', 10, 3);

function my_function($page_id, $page_slug, $recipe_slug) {
    // Check specific conditions
    if ($page_slug !== 'home' || $recipe_slug !== 'business') {
        return; // Don't run for other pages/recipes
    }

    // Your code here
}

Namespace Custom Functions

Avoid naming conflicts:

// Good - prefixed
function mycompany_custom_recipe() { }

// Better - namespaced
namespace MyCompany\LaunchPad;
function custom_recipe() { }

Key Takeaways

  • LaunchPad API reference provides launchpad_custom_recipes filter for adding recipes, launchpad_after_recipe_build action for post-build customization, and REST API endpoints for programmatic control
  • Always use filters (return modified values) vs actions (execute code without return) appropriately; filters modify data, actions perform operations
  • Best practices include setting specific hook priorities, checking conditions before execution, and namespacing custom functions to avoid conflicts

Extend LaunchPad Systematically

You’ve learned comprehensive LaunchPad API documentation covering filters, actions, REST endpoints, helper functions, and best practices. Using these documented APIs ensures your customizations survive updates while enabling powerful extensions.

Whether building custom recipes, integrating with third-party plugins, or creating client-specific functionality, the LaunchPad API provides clean, maintainable extension points.

Ready to build on LaunchPad? Explore the LaunchPad GitHub repository for complete source code and additional examples. For Pro API features and advanced integrations, explore LaunchPad Pro.

Leave a Reply

Your email address will not be published. Required fields are marked *