Documentation
Build

Queries

From plugin v1.37.13

Filters & Custom Queries

This page covers MisePress post types and taxonomies, archive filtering, and how to build custom WP_Query calls.

Post type

CPTSlugPurpose
Recipemp_recipeFull recipes with ingredients, steps, equipment, nutrition, schema

Taxonomies

TaxonomySlugApplies to
Allergenmp_allergenRecipes
Ingredientmp_ingredientRecipes
Cuisinemp_cuisineRecipes
Coursemp_courseRecipes

Archive URL filters

MisePress archive pages accept query string filters. Combine any of these with the post-type archive URL (e.g. /recipe/).

ParamExampleEffect
mp_cuisine?mp_cuisine=italian,frenchFilter by cuisine slug(s)
mp_course?mp_course=mainsFilter by course slug(s)
mp_ingredient?mp_ingredient=tomatoRecipes containing ingredient
mp_allergen_excl?mp_allergen_excl=gluten,dairyExclude posts tagged with allergen(s)
mp_diff?mp_diff=easyDifficulty filter (recipes)
mp_time?mp_time=30Total time ≤ N minutes
mp_servings?mp_servings=4Servings filter
mp_q?mp_q=ramenFree-text search
mp_sort?mp_sort=ratingSort: recent, rating, popular, quick

These are also driven by the front-end filter bar; any URL combination is bookmarkable.

Custom WP_Query example

Recent published recipes that contain "tomato" but not the gluten allergen:

$q = new WP_Query( array(
    'post_type'      => 'mp_recipe',
    'posts_per_page' => 12,
    'post_status'    => 'publish',
    'tax_query'      => array(
        'relation' => 'AND',
        array(
            'taxonomy' => 'mp_ingredient',
            'field'    => 'slug',
            'terms'    => array( 'tomato' ),
        ),
        array(
            'taxonomy' => 'mp_allergen',
            'field'    => 'slug',
            'terms'    => array( 'gluten' ),
            'operator' => 'NOT IN',
        ),
    ),
    'meta_query'     => array(
        array(
            'key'     => '_mp_total_time',
            'value'   => 30,
            'compare' => '<=',
            'type'    => 'NUMERIC',
        ),
    ),
) );

Smart collections in code

Use the [misepress_collection] shortcode or call the underlying helper:

echo do_shortcode( '[misepress_collection preset="popular" count="6"]' );

Available presets: popular, trending, quick, top-rated, new. Tune ranking with the misepress/ranking/weights filter.

Useful meta keys

Meta keyTypeMeaning
_mp_prep_timeintPrep time in minutes
_mp_cook_timeintCook time in minutes
_mp_total_timeintComputed total time
_mp_servingsintServings
_mp_difficultystringeasy / medium / hard
_mp_rating_avgfloatAverage user rating
_mp_rating_countintNumber of ratings
_mp_views_30dintRecent view counter
_mp_nutritionarrayCalories/protein/carbs/fat per serving
_mp_equipmentjsonEquipment required (name, note, optional URL)

Treat these as read-only when possible; MisePress writes them on save.

Product context

Need the high-level overview? Start with MisePress Recipes, the WordPress recipe plugin.