Exporting and importing global restrictions are new features debuting in version 2.0!
An excellent example of exporting restrictions is when you need to make a quick backup copy. That can save time because you don’t need to restore your entire site just to restore a restriction. All you have to do is import the backup copy that you exported earlier.
Be careful if you export restrictions and import them to a different site. If that site isn’t identical to the original site you exported from, you’ll have mismatches with your user roles, redirect URLs, metadata (e.g., tags and categories), and content.
Export 1 or More Global Restrictions
Follow these steps to export one or more global restrictions.
1. Go to Settings > Content Control
Log into your WordPress admin Dashboard. Then, go to Settings > Content Control.
2. Choose 1 or more restrictions, then click Bulk Actions > Export Selected
Click the checkbox next to the global restriction(s) you want to export. Then, expand the Bulk Actions dropdown menu and click Export Selected.
3. Keep or change the filename and select where you want to save the export file
Content Control v2 exports your restrictions to a JSON file named content-control-restrictions.json by default.
You can rename the file to something more meaningful and save it where it’s easy for you to find.
Import Global Restrictions
Follow these steps to import your global restrictions.
Make sure you go to Settings > Content Control before you start.
1. Click the more menu (vertical 3 dots), then Import
2. Choose your JSON export file
3. Look for the restrictions you imported
The restrictions in the JSON file you import will show up with priority 1, and they’ll be disabled by default. Here’s a quick demo that shows that.
Import Demo
Just to recap what the demo shows.
- We import New Restriction 1 and New Restriction 2.
- The 2 restrictions are off by default.
- Both restrictions have priority 1.
Remember!
If you’re importing to a different site, your General, Protection, and Content settings might not work the way you expect. That’s because your user roles (IDs) could be different, your custom URLs might not exist, and your content rules can have invalid content (e.g., different post IDs).