wp-pwa / wp-plugin

Old Frontity plugin. For the new one please visit https://github.com/frontity.
https://frontity.org
GNU General Public License v3.0
2 stars 1 forks source link

Add excludeFields query to REST API #88

Closed luisherranz closed 5 years ago

luisherranz commented 5 years ago

First, we need to use the query excludeFields insted of the database settings:

$filters = explode(',', $request->get_param('excludeFields'));
// instead of 
$settings = get_option('frontity_settings');
$filters = isset($settings['api_filters']) ? $settings['api_filters'] : array();  

in class-rest-api-filter-fields.php.

But we also need that query to be present in the _links urls so they also filter out the excluded fields.

That requires more investigation, but this is a good starting point: https://v2.wp-api.org/extending/linking/

The previous plugin author was using rest_get_server to retrieve the data with both _links and _embed included. https://developer.wordpress.org/reference/classes/wp_rest_server/

frontibotito commented 5 years ago

:tada: This issue has been resolved in version 1.12.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: