How to replace generated PHP Settings with Local Storage

This article explains how you can replace your generated PHP settings with Local Storage. We introduced Local Storage since Admin Columns Pro 5.1 which allows you to store column settings on the file system in PHP files. Local Storage is the replacement for the old Generated PHP Settings.

If you have been using the old Generate PHP, you can follow this guide to migrate these settings to Local Storage


Instructions

Before continuing, we also have a migration script you can use which automatically migrates the PHP column settings for you.

How to manually migrate the PHP settings to Local Storage

  1. Make sure you have installed the latest version of Admin Columns Pro ( at least 5.1 or higher)
  2. Go to the Setting page and check if you still see the PHP loaded columns. They are marked with a Lock icon.
  3. Now you can set up Local Storage by adding this filter to your theme's functions.php. This will set the storage directory to a folder on your file system. Every time you save your column settings, a new PHP file will be created in the provided folder. Once this hook is loaded, all column settings will be loaded from your directory.

  4. Go to the Column Settings Page, and make a duplicate of each Column Set with a lock icon next to it.
  5. You should now have duplicates of the Column Sets with a lock icon, like so:
  6. We will now make the duplicates read-only by adding this filter to your theme's functions.php

  7. They should now all have a lock icon, like so:
  8. The Column settings are now stored with Local Storage. You can remove the old PHP generated code from your theme.

    The old code contains the function ac_load_columns or ac_register_columns.
  9. The column settings are now loaded with Local Storage.

Use Migration Snippet

We wrote a snippet that can automatically migrate all PHP loaded columns to Local Storage. Copy the snippet from the following page to your codebase and run the script as described in the script. Make sure that Local Storage is already configured.

https://github.com/codepress/admin-columns-hooks/blob/master/snippets/migrate-php-to-local-storage.php

Still need help? Contact Us Contact Us