Minimal Mode

WP Ultimate Recipe is an extensive plugin and will use quite a bit of resources for all it’s features. Unfortunately there’s no performant way of knowing which pages will require all those features and which pages don’t. Therefore the plugin is loaded entirely on each page.

Advanced users can use the wpurp_minimal_mode plugin hook to put the plugin in Minimal Mode on frontend pages where no recipe templates or other recipe features are used to spare resources.

To do so you must create a Must-Use Plugin by creating a wpurp-minimal-mode.php file in your /wp-content/mu-plugins/ folder.

The wpurp-minimal-mode.php file should look like this:

<?php
function wpurp_minimal_mode( $minimal_mode, $url ) {
    return $minimal_mode;
}
add_filter( 'wpurp_minimal_mode', 'wpurp_minimal_mode', 10, 2 );

By default $minimal_mode is false and $url will return the current page you’re on, which can be used to decide if Minimal Mode will be activated.

Depending on your specific needs you could end up with something like this:

<?php
function wpurp_minimal_mode( $minimal_mode, $url ) {
    if( $url == '/' ) return true; // Homepage

    preg_match( "/^\/user/i", $url, $matches );
    if( count( $matches ) > 0 ) return true; // Any URL starting with /user

    return false;
}
add_filter( 'wpurp_minimal_mode', 'wpurp_minimal_mode', 10, 2 );