Skip to content

Commit

Permalink
Merge pull request #311 from mustafauysal/fix/classify-post-action
Browse files Browse the repository at this point in the history
Fix/classify post action
  • Loading branch information
jeffpaul authored Oct 7, 2021
2 parents 8dc621f + 2eeb636 commit 9203646
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion includes/Classifai/Admin/BulkActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function bulk_action_handler( $redirect_to, $doaction, $post_ids ) {
if ( 'classify' !== $doaction ) {
return $redirect_to;
}

foreach ( $post_ids as $post_id ) {
$this->save_post_handler->classify( $post_id );
}
Expand Down Expand Up @@ -121,9 +122,15 @@ public function bulk_action_admin_notice() {
* @return array
*/
public function register_row_action( $actions, $post ) {
$post_types = get_supported_post_types();

if ( ! in_array( $post->post_type, $post_types, true ) ) {
return $actions;
}

$actions['classify'] = sprintf(
'<a href="%s">%s</a>',
esc_url( wp_nonce_url( admin_url( 'edit.php?action=classify&ids=' . $post->ID ), 'bulk-posts' ) ),
esc_url( wp_nonce_url( admin_url( sprintf( 'edit.php?action=classify&ids=%d&post_type=%s', $post->ID, $post->post_type ) ), 'bulk-posts' ) ),
esc_html__( 'Classify', 'classifai' )
);

Expand Down

0 comments on commit 9203646

Please sign in to comment.