Skip to content
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

New filter: allow content classification by $post_status #309

Closed
jamesmorrison opened this issue Sep 8, 2021 · 4 comments · Fixed by #310
Closed

New filter: allow content classification by $post_status #309

jamesmorrison opened this issue Sep 8, 2021 · 4 comments · Fixed by #310
Assignees
Labels
type:enhancement New feature or request.
Milestone

Comments

@jamesmorrison
Copy link
Member

jamesmorrison commented Sep 8, 2021

Is your enhancement related to a problem? Please describe.
Currently, there is no hook / filter to enable content classification based on $post_status; content classification can only be processed where a post is actually published.

// Only process published, supported items and only if features are enabled
if ( 'publish' === $post_status && in_array( $post_type, $supported, true ) && \Classifai\language_processing_features_enabled() ) {
	$this->classify( $post_id );
}

https://github.com/10up/classifai/blob/develop/includes/Classifai/Admin/SavePostHandler.php#L66

Describe the solution you'd like
An additional filter; which allows an array of post statuses to be used. This will allow (for example) a post with post status draft to be processed (prior to publication).

Designs
N/A - functional changes only

Describe alternatives you've considered
Externally, the Classifai\Admin\SavePostHandler class could be extended to allow the same change.

@jamesmorrison jamesmorrison added the type:enhancement New feature or request. label Sep 8, 2021
@jeffpaul jeffpaul added this to the Future Release milestone Sep 8, 2021
@jeffpaul
Copy link
Member

jeffpaul commented Sep 8, 2021

Tagging in @dkotter to confirm best approach on this before we get someone to work on this / align to a milestoned release.

@dkotter
Copy link
Collaborator

dkotter commented Sep 8, 2021

Left comments on the PR but to capture those here as well, I think we can copy how we do the supported post types, by adding a new helper method to get the supported post stati with a filter there. We could also add these as options to our settings page, which might be nice.

@jeffpaul jeffpaul modified the milestones: Future Release, 1.8.0 Oct 12, 2021
@jeffpaul jeffpaul modified the milestones: 1.8.0, 1.7.1 Apr 22, 2022
@jeffpaul
Copy link
Member

@jamesmorrison @dkotter did these options get added to the settings page or should we open a subsequent issue to track that work?

@dkotter
Copy link
Collaborator

dkotter commented Apr 22, 2022

Yes, these got added to the settings screen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants