Add CSV/JSON export for redirects#452
Open
nhrrob wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
Adds the ability to export all redirect rules from the wp-admin redirect list
table as either a CSV or JSON file.
A format dropdown and an Export button appear in the top toolbar of the
Redirects screen. Selecting a format and clicking Export downloads the file
immediately. Each exported record includes: ID, Redirect From, Redirect To,
HTTP Status Code, Enable Regex, Force HTTPS, Message, and Status.
The export is protected by a nonce and a capability check using the existing
srm_restrict_to_capabilityfilter, so only authorized users can trigger adownload. CSV output is also protected against formula injection attacks.
Closes #
Partially related to #43
After adding the Export feature, we can add the .htaccess export support too. PR is designed to be able to easily extend any future export types.
How to test the Change
.csvfile downloads with allredirect data and correct column headers.
.jsonfile downloads as avalid JSON array with the same data.
Export button is not shown.
Changelog Entry
Credits
Props @nhrrob
Checklist:
Notes: