All Topics
use local storage
Hi, I’d like to use local storage to avoid database queries as much as possible.
I’ve tested the following code, but no file is created in the folder.
// ADVANCED COLUMNS PRO
add_filter('acp/storage/file/directory', function () {
// Use a writable path, directory will be created for you
return get_stylesheet_directory() . '/back-end/acp';
});
add_filter('acp/storage/file/directory/writable', '__return_false');
add_filter('acp/storage/file/directory/migrate', '__return_true');
I also tried a code to generate php file, it’s work but i think it’s better with .json, and i just reduced one request from DB, this is the code:
add_filter(
'acp/storage/repositories',
function (array $repositories, ListScreenRepositoryFactory $factory) {
$post_types = ['post', 'project', 'lieu', 'map', 'contact', 'movie', 'wp-media', 'page'];
foreach ($post_types as $pt) {
$rules = new Rules();
$rules->add_rule(new Rule\EqualType($pt));
$repositories[$pt] = $factory->create(
get_stylesheet_directory() . "/back-end/acp/${pt}",
true,
$rules
);
}
return $repositories;
},
10,
2
);
Any advices, what i’m doing wrong
Thank you in advance
You must be logged in to reply to this topic.