3

I have static data that my plugin requires as an array (multidimensional with 100s of items), it doesn't need to change and it seems overkill to store in a database and not appropriate as just arrays in my code.

Options I have considered:

  • Json files - load them in
  • In the config file

Which is best and is there a more appropriate way to store access?

4

What format is the source data in? If it's already in a multidimensional PHP array, then it might be as simple as having a data.php file in your plugin and doing a require_once in your plugin's init() method and you're good to go.

Even if it's in a different format, loading it from init() and parsing it into the multidimensional array is a good option.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.