Contents

Hooks Reference — Plugixa Recipe

Plugixa Recipe exposes WordPress actions and filters at every major extension point — from activation through frontend rendering. All hooks use the plugixarecipe_ prefix.

License / feature gating

Filters

plugixarecipe_license_is_pro

Override the plugin’s “is Pro” resolution — useful for staging sites that have the Pro code but no license.

add_filter('plugixarecipe_license_is_pro', function ($is_pro) {
    return defined('PLUGIXA_STAGING') && PLUGIXA_STAGING ? true : $is_pro;
});

Activation / deactivation

Actions

plugixarecipe_activated

Fires at the end of class-activator.php::activate(). Use for your own one-time setup (registering extra tables, seeding integration data).

plugixarecipe_deactivated

Fires on plugin deactivation. Useful for cleaning up cron jobs or caches your integration created.

Recipe lifecycle

Actions

  • plugixarecipe_before_recipe_save($data, $context) — fires before insert/update.
  • plugixarecipe_after_recipe_save($recipe_id, $data, $context) — after successful save. $context is 'create' or 'update'.
  • plugixarecipe_before_recipe_delete($recipe_id) — before cascading deletes.
  • plugixarecipe_after_recipe_delete($recipe_id) — after the recipe and its children are gone.
  • plugixarecipe_recipe_status_changed($recipe_id, $new_status, $old_status) — whenever status transitions (draft → published, etc.).

Filters

  • plugixarecipe_recipe_data_before_save($data, $context) — mutate the data array before write.
  • plugixarecipe_recipe_data_for_response($data, $recipe) — mutate the data returned by the REST endpoint.

Reviews

Actions

  • plugixarecipe_before_review_submit($review_data) — right before DB write.
  • plugixarecipe_after_review_submit($review_id, $review_data) — after insert. Use to send notifications.
  • plugixarecipe_review_status_changed($review_id, $new_status, $old_status).

Filters

  • plugixarecipe_review_submission_data($data) — mutate before save.
  • plugixarecipe_review_validation_rules($rules) — extend the yup-ish validation (server-side).

Frontend submission

  • plugixarecipe_before_frontend_submission($data) — filter before validate + save.
  • plugixarecipe_after_frontend_submission($recipe_id, $data) — fire after insert.
  • plugixarecipe_frontend_form_fields($fields) — customize which form fields render.

AI Generator (Pro)

Actions

  • plugixarecipe_before_ai_generate($input, $provider_name, $count)$input is the topic string / URL / file path.
  • plugixarecipe_after_ai_generate($recipes, $input, $provider_name)$recipes is the normalized array.

Filters

  • plugixarecipe_ai_generated_recipes($recipes, $input, $provider_name) — mutate (inject house style, add tags, force status).
  • plugixarecipe_ai_provider_config($config, $provider_name) — add headers, change base URL.
  • plugixarecipe_ai_prompt($prompt, $context) — rewrite the LLM prompt.

Import / Export (Pro)

  • plugixarecipe_before_import_recipe($data) — tweak each incoming recipe.
  • plugixarecipe_after_import($summary) — summary has created, updated, skipped, errors.
  • plugixarecipe_export_recipe_data($data, $recipe) — customize exported fields.

Schema / SEO (Pro)

  • plugixarecipe_schema_enabled($enabled, $recipe) — per-recipe on/off.
  • plugixarecipe_schema_payload($data, $recipe) — last-mile mutation of the JSON-LD.
  • plugixarecipe_seo_issues($issues, $recipe) — add/remove SEO checks.
  • plugixarecipe_seo_score($score, $recipe) — override the final score.

Rendering

Actions

  • plugixarecipe_before_shortcode_render($atts, $config) — before the template runs.
  • plugixarecipe_after_shortcode_render($html, $atts) — after; $html is the rendered string.
  • plugixarecipe_before_single_recipe($recipe_id) / plugixarecipe_after_single_recipe($recipe_id) — wrap the single recipe page.

Filters

  • plugixarecipe_template_path($path, $template) — customize the template loader.
  • plugixarecipe_shortcode_defaults($defaults) — modify the default attribute values.
  • plugixarecipe_card_meta_items($items, $recipe) — mutate the meta row on cards (rating, views, likes, …).
  • plugixarecipe_rewrite_rules($rules) — add / alter rewrite patterns.
  • plugixarecipe_recipe_permalink($url, $recipe) — change how single recipe URLs are built.

REST API

  • plugixarecipe_rest_public_routes($routes) — add routes to the public (no-auth) list.
  • plugixarecipe_rest_response($response, $request, $endpoint) — mutate any REST response.

Email notifications

  • plugixarecipe_email_recipients($recipients, $event) — override who receives.
  • plugixarecipe_submission_email_body($body, $recipe_data) — customize text.

Multilingual

  • plugixarecipe_current_language($language) — override the detected language.
  • plugixarecipe_translatable_fields($fields, $resource) — WPML/Polylang tweaks.

Example: restrict recipe creation to editors

add_filter('plugixarecipe_rest_public_routes', function ($routes) {
    // Remove the public-read POST for recipes; require auth.
    return array_filter($routes, fn($r) => $r !== '/recipes:POST');
});

Example: auto-tag AI-generated recipes

add_filter('plugixarecipe_ai_generated_recipes', function ($recipes) {
    foreach ($recipes as &$r) {
        $r['tags'][] = 'ai-generated';
        $r['status'] = 'pending'; // Always moderate AI content.
    }
    return $recipes;
});

Example: add a custom SEO check

add_filter('plugixarecipe_seo_issues', function ($issues, $recipe) {
    if (count($recipe['ingredients'] ?? []) < 3) {
        $issues[] = [
            'check_id'     => 'enough_ingredients',
            'category'     => 'content',
            'type'         => 'warning',
            'message'      => 'Recipe has fewer than 3 ingredients.',
            'suggestion'   => 'Add more detail — very short recipes rank poorly.',
            'score_impact' => 4,
        ];
    }
    return $issues;
}, 10, 2);

Discovery tips

  • All hooks live in the /includes/ and /pro/includes/ PHP files. Grep for do_action( / apply_filters( to see every call site.
  • When in doubt, check the controller for the feature — e.g., AI hooks are in pro/includes/api/class-ai-generator-controller.php.
  • New hooks are added with new features — watch the release notes.

Quick Links