Hooks Reference
Hooks Reference
MisePress exposes WordPress filters and actions for developers to customize behavior without touching plugin files. Hooks fall into two namespaces:
misepress/...— slash-namespaced (modern, preferred for new code).misepress_...— underscore-namespaced (legacy, kept for backward compatibility).
Filters
misepress/schema/recipe
Modify the Schema.org Recipe JSON-LD before output.
add_filter( 'misepress/schema/recipe', function( $data, $post ) {
$data['author'] = array(
'@type' => 'Person',
'name' => get_the_author_meta( 'display_name', $post->post_author ),
);
return $data;
}, 10, 2 );
misepress/search/synonyms
Extend the search synonym map. Useful for niche cuisine vocabulary or branded ingredients.
add_filter( 'misepress/search/synonyms', function( $map ) {
$map['aubergine'] = 'eggplant';
$map['courgette'] = 'zucchini';
return $map;
} );
misepress/ranking/weights
Tune the ranking weights used by smart collections and search ordering.
add_filter( 'misepress/ranking/weights', function( $w ) {
$w['rating'] = 3.0;
$w['recency'] = 0.5;
$w['popularity'] = 1.5;
return $w;
} );
misepress/collection/args
Customize the WP_Query arguments used by [misepress_collection] and friends.
add_filter( 'misepress/collection/args', function( $args, $preset, $limit ) {
if ( 'popular' === $preset ) {
$args['meta_key'] = '_mp_views_30d';
}
return $args;
}, 10, 3 );
misepress/recommendations/auto_inject
Disable automatic injection of related recipes under single recipe content.
add_filter( 'misepress/recommendations/auto_inject', '__return_false' );
misepress/qr_image_url
Reserved for future integrations.
add_filter( 'misepress/qr_image_url', function( $src, $url ) {
return 'https://qr-service.example.test/?d=' . rawurlencode( $url );
}, 10, 2 );
misepress/term_image_taxonomies
Choose which taxonomies show the term-image picker.
add_filter( 'misepress/term_image_taxonomies', function( $taxes ) {
$taxes[] = 'category';
return $taxes;
} );
misepress/importer/unit_aliases
Add unit aliases for the importer (locale-specific or branded units).
add_filter( 'misepress/importer/unit_aliases', function( $map ) {
$map['knl'] = 'tsp'; // hypothetical Norwegian alias
return $map;
} );
misepress_nutrition_enabled
Disable the nutrition module conditionally.
add_filter( 'misepress_nutrition_enabled', '__return_false' );
misepress_release_channel
Switch the update channel. Default is stable.
add_filter( 'misepress_release_channel', function() { return 'beta'; } );
misepress_api_base
Override the licensing/update API base URL (for self-hosted update servers).
Actions
misepress/pre_get_posts
Fires inside MisePress's archive query just before WordPress runs it. Receives the WP_Query instance.
add_action( 'misepress/pre_get_posts', function( $q ) {
if ( $q->is_post_type_archive( 'mp_recipe' ) ) {
$q->set( 'posts_per_page', 24 );
}
} );
misepress/search/logged
Fires after a search request is recorded. Useful for analytics integrations.
add_action( 'misepress/search/logged', function( $post_type, $request, $context ) {
// Send to your analytics pipeline.
}, 10, 3 );
misepress/email_subscribed
Fires when a visitor submits the engagement email-capture form.
add_action( 'misepress/email_subscribed', function( $email ) {
// Push to Mailchimp, Klaviyo, etc.
} );
Capability checks
MisePress only exposes admin operations to users with relevant capabilities:
| Operation | Capability |
|---|---|
| Edit settings | manage_options |
| Edit recipes | edit_posts for the matching CPT |
| Assign term images | edit_terms for that taxonomy |
| Run import/export tools | manage_options |
All admin-post and AJAX endpoints are nonce-protected.
Need the high-level overview? Start with MisePress Recipes, the WordPress recipe plugin.