Skip to content

Commit e4d3ac2

Browse files
committed
(feat): add taxonomies added through apply_filter to the api
1 parent f8aadfd commit e4d3ac2

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v3.7.6
4+
5+
- Feat: add taxonomies to API added through apply_filter
6+
37
## v3.7.5
48

59
- Feat: add author id in API response of items endpoint

openpub-base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin Name: Yard | OpenPub Base
55
* Plugin URI: https://www.openwebconcept.nl/
66
* Description: Acts as foundation for other OpenPub related content plugins. This plugin implements actions to allow for other plugins to add and/or change Custom Posttypes, Metaboxes, Taxonomies, en Posts 2 posts relations.
7-
* Version: 3.7.5
7+
* Version: 3.7.6
88
* Author: Yard | Digital Agency
99
* Author URI: https://www.yard.nl/
1010
* License: GPL-3.0

src/Base/Foundation/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class Plugin
99
{
1010
public const NAME = 'openpub-base';
11-
public const VERSION = '3.7.5';
11+
public const VERSION = '3.7.6';
1212

1313
protected string $rootPath;
1414
public Config $config;

src/Base/RestAPI/ItemFields/TaxonomyField.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,17 @@ class TaxonomyField extends CreatesFields
1212
*/
1313
public function create(WP_Post $post): array
1414
{
15-
$result = [];
15+
$result = [];
1616

17-
foreach (array_keys($this->plugin->config->get('taxonomies')) as $taxonomy) {
17+
$taxonomies = apply_filters('owc/openpub-base/before-register-extended-taxonomies', $this->plugin->config->get('taxonomies'));
18+
19+
if (! is_array($taxonomies) || 1 > count($taxonomies)) {
20+
return $result;
21+
}
22+
23+
$taxonomiesKeys = array_unique(array_keys($taxonomies));
24+
25+
foreach ($taxonomiesKeys as $taxonomy) {
1826
$result[$taxonomy] = $this->getTerms($post->ID, $taxonomy);
1927
}
2028

0 commit comments

Comments
 (0)