Ensure that the export template endpoint returns a WP_Error object, including code and message, so that the site editor can display an error message.
Add some basic unit tests to ensure that permission checks are working as expected.
Follow-up to [52286].
Props Spacedmonkey, dlh, hellofromTonya , Mamaduka, TimothyBlynJacobs.
Fixes#54448.
Built from https://develop.svn.wordpress.org/trunk@52340
git-svn-id: http://core.svn.wordpress.org/trunk@51932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add a REST API to export site templates and template part as html files. When the REST API is requested, it responds by downloading a single ZIP file and exits early, without completing full request. To create the exported zip, the ZipArchive class is required. If this class is not present then the export will gracefully fail, returning a `WP_Error` object and 500 status error code.
Props spacedmonkey, youknowriad, Mamaduka, walbo, peterwilsoncc.
Fixes#54448 .
Built from https://develop.svn.wordpress.org/trunk@52286
git-svn-id: http://core.svn.wordpress.org/trunk@51878 1a063a9b-81f0-0310-95a4-ce76da25c4cd