-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Assign imported posts to categories based on the keywords #1035
base: development
Are you sure you want to change the base?
Conversation
$auto_categories = array_filter( $auto_categories, function( $item ) { | ||
if ( ! empty( $item['keywords'] ) && is_numeric( $item['category'] ) ) { | ||
$item['keywords'] = sanitize_text_field( $item['keywords'] ); | ||
return true; | ||
} | ||
return false; | ||
} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to have a separate context here. A filter should filter the items, a map should modify the items.
$auto_categories = array_filter( $auto_categories, function( $item ) {
return ! empty( $item['keywords'] ) && is_numeric( $item['category'] );
});
$auto_categories = array_map(function( $item ) {
$item['keywords'] = sanitize_text_field( $item['keywords'] );
return $item;
}, $auto_categories);
<div class="help-text pt-8"> | ||
<?php | ||
printf( | ||
// translators: %s is a placeholder for the auto categories tag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One tip here is to include the actual value in the translator's comment to give them a better context. You can append it like this (like "[#auto_categories]")
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I left some suggestions.
Summary
Information here: https://github.com/Codeinwp/feedzy-rss-feeds-pro/pull/802
Check before Pull Request is ready:
Closes #https://github.com/Codeinwp/feedzy-rss-feeds-pro/issues/768.