Version Description
fix endpoint with field name - exemple: /wp-json/acf/v3/posts/{id}/{field-name}
Download this release
Release Info
Developer | airesvsg |
Plugin | ACF to REST API |
Version | 3.3.1 |
Comparing to | |
See all releases |
Code changes from version 3.3.0 to 3.3.1
- class-acf-to-rest-api.php +2 -2
- composer.json +1 -1
- readme.txt +4 -1
- v3/lib/class-acf-to-rest-api-acf-api.php +2 -1
class-acf-to-rest-api.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Description: Exposes Advanced Custom Fields Endpoints in the WordPress REST API
|
5 |
* Author: Aires Gonçalves
|
6 |
* Author URI: http://github.com/airesvsg
|
7 |
-
* Version: 3.3.
|
8 |
* Plugin URI: http://github.com/airesvsg/acf-to-rest-api
|
9 |
*/
|
10 |
|
@@ -16,7 +16,7 @@ if ( ! class_exists( 'ACF_To_REST_API' ) ) {
|
|
16 |
|
17 |
class ACF_To_REST_API {
|
18 |
|
19 |
-
const VERSION = '3.3.
|
20 |
|
21 |
private static $old_request_version = 2;
|
22 |
private static $default_request_version = 3;
|
4 |
* Description: Exposes Advanced Custom Fields Endpoints in the WordPress REST API
|
5 |
* Author: Aires Gonçalves
|
6 |
* Author URI: http://github.com/airesvsg
|
7 |
+
* Version: 3.3.1
|
8 |
* Plugin URI: http://github.com/airesvsg/acf-to-rest-api
|
9 |
*/
|
10 |
|
16 |
|
17 |
class ACF_To_REST_API {
|
18 |
|
19 |
+
const VERSION = '3.3.1';
|
20 |
|
21 |
private static $old_request_version = 2;
|
22 |
private static $default_request_version = 3;
|
composer.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"name": "airesvsg/acf-to-rest-api",
|
3 |
"description": "Exposes Advanced Custom Fields Endpoints in the WordPress REST API",
|
4 |
"type": "wordpress-plugin",
|
5 |
-
"version": "3.3.
|
6 |
"keywords": ["wordpress", "wp", "rest-api", "acf", "wp-api", "json", "wordpres-plugin", "fields"],
|
7 |
"homepage": "https://github.com/airesvsg/acf-to-rest-api",
|
8 |
"license": "GPL-2.0-only",
|
2 |
"name": "airesvsg/acf-to-rest-api",
|
3 |
"description": "Exposes Advanced Custom Fields Endpoints in the WordPress REST API",
|
4 |
"type": "wordpress-plugin",
|
5 |
+
"version": "3.3.1",
|
6 |
"keywords": ["wordpress", "wp", "rest-api", "acf", "wp-api", "json", "wordpres-plugin", "fields"],
|
7 |
"homepage": "https://github.com/airesvsg/acf-to-rest-api",
|
8 |
"license": "GPL-2.0-only",
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=E5M7H
|
|
4 |
Tags: acf, api, rest, wp-api, wp-rest-api, json, wp, wordpress, wp-rest-api, wordpress-rest-api
|
5 |
Requires at least: 4.6
|
6 |
Tested up to: 5.4.2
|
7 |
-
Stable tag: 3.3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -21,6 +21,9 @@ Exposes [Advanced Custom Fields](https://wordpress.org/plugins/advanced-custom-f
|
|
21 |
|
22 |
== Changelog ==
|
23 |
|
|
|
|
|
|
|
24 |
= 3.3.0 =
|
25 |
fix vulnerabilities ( https://github.com/airesvsg/acf-to-rest-api/issues/317 ) - Thanks to Hoseta
|
26 |
|
4 |
Tags: acf, api, rest, wp-api, wp-rest-api, json, wp, wordpress, wp-rest-api, wordpress-rest-api
|
5 |
Requires at least: 4.6
|
6 |
Tested up to: 5.4.2
|
7 |
+
Stable tag: 3.3.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
21 |
|
22 |
== Changelog ==
|
23 |
|
24 |
+
= 3.3.1 =
|
25 |
+
fix endpoint with field name - exemple: /wp-json/acf/v3/posts/{id}/{field-name}
|
26 |
+
|
27 |
= 3.3.0 =
|
28 |
fix vulnerabilities ( https://github.com/airesvsg/acf-to-rest-api/issues/317 ) - Thanks to Hoseta
|
29 |
|
v3/lib/class-acf-to-rest-api-acf-api.php
CHANGED
@@ -80,7 +80,8 @@ if ( ! class_exists( 'ACF_To_REST_API_ACF_API' ) ) {
|
|
80 |
}
|
81 |
|
82 |
if ( $this->get_id( $request ) ) {
|
83 |
-
|
|
|
84 |
$data[ $field ] = get_field( $field, $this->id );
|
85 |
} else {
|
86 |
$fields = get_fields( $this->id );
|
80 |
}
|
81 |
|
82 |
if ( $this->get_id( $request ) ) {
|
83 |
+
$is_option = 'option' == $this->type && 'options' == $this->id;
|
84 |
+
if ( $field && ( $is_option || ! $is_option && $this->id > 0 ) ) {
|
85 |
$data[ $field ] = get_field( $field, $this->id );
|
86 |
} else {
|
87 |
$fields = get_fields( $this->id );
|