(feat): add taxonomies to the api added through apply_filter #41
Merged
YvetteNikolov merged 1 commit intomasterfrom Jul 17, 2025
Merged
(feat): add taxonomies to the api added through apply_filter #41YvetteNikolov merged 1 commit intomasterfrom
YvetteNikolov merged 1 commit intomasterfrom
Conversation
cadd1dd to
d051035
Compare
mvdhoek1
reviewed
Jul 17, 2025
| $result = []; | ||
|
|
||
| foreach (array_keys($this->plugin->config->get('taxonomies')) as $taxonomy) { | ||
| $configTaxonomies = array_keys($this->plugin->config->get('taxonomies')); |
Contributor
There was a problem hiding this comment.
Doet dit niet hetzelfde?
/**
* Create an additional field on an array.
*/
public function create(WP_Post $post): array
{
$result = [];
$taxonomies = apply_filters('owc/openpub-base/before-register-extended-taxonomies', $this->plugin->config->get('taxonomies'));
if (! is_array($taxonomies) || 1 > count($taxonomies)) {
return $result;
}
$taxonomiesKeys = array_unique(array_keys($taxonomies));
foreach ($taxonomiesKeys as $taxonomy) {
$result[$taxonomy] = $this->getTerms($post->ID, $taxonomy);
}
return $result;
}
Contributor
Author
There was a problem hiding this comment.
Getest, werkt goed, veel beter zo
d051035 to
e4d3ac2
Compare
mvdhoek1
approved these changes
Jul 17, 2025
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.
Simon had hier toegevoegd dat je taxonomieën kon toevoegen aan de OpenPub items. Deze werden echter niet aan de API meegegeven. Dit voegt het wel toe.
Kan qua code style wellicht wat beter, ik hoor het graag.