Filter
uncanny-automator
automator_manifest_use_db
Filters whether the Automator database should be used when loading the manifest, allowing for custom database handling.
add_filter( 'automator_manifest_use_db', $callback, 10, 1 );
Description
Fires when determining if the recipe manifest should be persisted to the database. Developers can return `false` to force the manifest to rebuild on every request, bypassing the database. This offers a way to disable database caching for the manifest.
Usage
add_filter( 'automator_manifest_use_db', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Conditionally disable database persistence for the automator manifest.
*
* This is useful for development or testing environments where you might
* want to ensure the manifest is always rebuilt on each request to catch
* any changes immediately, without needing to clear the database cache.
*
* @param bool $use_db The current setting for using the database.
* @return bool False to disable database persistence, true to keep it.
*/
add_filter( 'automator_manifest_use_db', function( $use_db ) {
// In a development environment, disable DB persistence.
if ( defined( 'WP_ENV' ) && 'development' === WP_ENV ) {
return false;
}
// Otherwise, use the default behavior (which is to use the DB).
return $use_db;
}, 10, 1 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/core/lib/recipe-parts/class-recipe-manifest.php:148
private function should_use_db() {
return (bool) apply_filters( 'automator_manifest_use_db', true );
}