There is very little overhead to assigning couple of filters on hooks that simply won’t fire on front end.
In general it would be something like this:
add_action('init', 'admin_only');
function admin_only() {
if( !is_admin() )
return;
// filter assignemnts and such go here
}
Also create_function()
is not recommended for performance and some other reasons. It is better to use more modern Anonymous Functions, but for cases like this WordPress provides ready-made __return_true()
function.