Contents

Hooks Reference - Plugixa Recipe

Plugixa Recipe exposes 19 hooks: 6 actions and 13 filters. Every one is listed on this page, and nothing is listed here that the plugin does not fire.

All hook names are prefixed plugixa_recipe_. Fourteen are in the free build; five belong to the premium overlay and only exist when Pro is installed.

The premium overlay is built on these same hooks. pro-bootstrap.php registers itself with add_action('plugixa_recipe_save_recipe', ...), add_filter('plugixa_recipe_recipe_child_tables', ...) and the rest. There is no private API underneath: anything Pro does to a recipe, your own code can do the same way.

Actions

Hook Arguments Fires
plugixa_recipe_save_recipe $recipe_id, $params After a recipe is created or updated through the REST API
plugixa_recipe_delete_recipe $id After a recipe and its child rows are deleted
plugixa_recipe_duplicate_recipe $new_id, $id After a recipe is duplicated, which is how a translation is created
plugixa_recipe_frontend_submission_saved $recipe_id, $get_param After a visitor’s frontend submission is stored
plugixa_recipe_before_ai_generate PRO $topic, $provider, $count Immediately before a request is sent to the AI provider
plugixa_recipe_after_ai_generate PRO $recipes, $topic, $provider After the provider returns and the drafts are parsed

Filters

Hook Filtered value Purpose
plugixa_recipe_prepare_recipe_admin $recipe, $id The recipe array on its way into an admin REST response
plugixa_recipe_prepare_recipe_frontend $recipe, $id The recipe array on its way into a public REST response
plugixa_recipe_recipe_child_tables $tables Table names, without the plugin prefix, that are keyed by recipe_id and must be deleted or copied with a recipe
plugixa_recipe_rest_controllers string[] Fully-qualified controller class names to register alongside the built-in ones
plugixa_recipe_settings_defaults $defaults The default settings array, before any stored values are merged over it
plugixa_recipe_sanitize_settings $sanitized, $params, $current The sanitized settings payload before it is written
plugixa_recipe_allowed_html $allowed, $context The wp_kses() allowlist used for frontend output
plugixa_recipe_content_allowed_html $allowed The allowlist used for long-form recipe content
plugixa_recipe_admin_i18n_strings $strings Strings handed to the React admin
plugixa_recipe_multilingual_entities $map Translatable entities. Recipes, categories and cuisines are built in
plugixa_recipe_ai_provider_config PRO $config, $provider Provider request configuration before the call
plugixa_recipe_ai_generated_recipes PRO $data, $topic, $provider Parsed AI drafts before they are returned for review
plugixa_recipe_submission_form_fields PRO array Extra fields appended to the public submission form

Worked examples

Force every imported or API-created recipe to pending

add_action( 'plugixa_recipe_save_recipe', function ( $recipe_id, $params ) {
    if ( ! empty( $params['status'] ) && 'publish' === $params['status'] ) {
        return;
    }
    // Your own moderation step here.
}, 10, 2 );

Register your own REST controller

add_filter( 'plugixa_recipe_rest_controllers', function ( array $controllers ) {
    $controllers[] = \MyPlugin\Api\BrewingController::class;
    return $controllers;
} );

The class is checked with class_exists() before it is instantiated, so a stale entry cannot fatal the REST API.

Keep your own table in step with a recipe

add_filter( 'plugixa_recipe_recipe_child_tables', function ( array $tables ) {
    $tables[] = 'brewing_notes';   // wp_plugixa_recipe_brewing_notes
    return $tables;
} );

Names are given without the wp_plugixa_recipe_ prefix. Every table listed here is keyed by recipe_id, and is deleted with the recipe and copied when one is duplicated.

Allow one extra tag in recipe output

add_filter( 'plugixa_recipe_allowed_html', function ( array $allowed, string $context ) {
    $allowed['abbr'] = [ 'title' => true ];
    return $allowed;
}, 10, 2 );

Add a field to the public submission form PRO

add_filter( 'plugixa_recipe_submission_form_fields', function ( array $fields ) {
    $fields[] = [
        'key'      => 'oven_type',
        'label'    => 'Oven type',
        'type'     => 'select',
        'options'  => [ 'fan', 'conventional' ],
        'required' => false,
    ];
    return $fields;
} );

Values submitted through these fields are saved by the same custom-fields code that handles them in the admin, on plugixa_recipe_frontend_submission_saved.

What is not here

The plugin has no hooks for shortcode rendering, template resolution, permalinks, schema output, sitemap entries, e-mail recipients or licence state. If you need to change rendered markup, use a theme template override rather than a filter: copy a template into your-theme/plugixa-recipe/ and it is used instead of the plugin’s own.

Quick Links