Make sure wp_list_pluck() is fed an array

This commit is contained in:
Nabil Kadimi
2018-02-22 17:35:41 +00:00
committed by GitHub
parent 87887a38aa
commit 4844945c26

View File

@@ -49,7 +49,7 @@ class SP_Meta_Box_Staff_Details {
endif;
$roles = get_the_terms( $post->ID, 'sp_role' );
$role_ids = wp_list_pluck( $roles, 'term_id' );
$role_ids = is_array( $roles ) ? wp_list_pluck( $roles, 'term_id' ) : array();
$teams = get_posts( array( 'post_type' => 'sp_team', 'posts_per_page' => -1 ) );
$past_teams = array_filter( get_post_meta( $post->ID, 'sp_past_team', false ) );
@@ -155,4 +155,4 @@ class SP_Meta_Box_Staff_Details {
sp_update_post_meta_recursive( $post_id, 'sp_past_team', sp_array_value( $_POST, 'sp_past_team', array() ) );
sp_update_post_meta_recursive( $post_id, 'sp_team', array_merge( array( sp_array_value( $_POST, 'sp_current_team', array() ) ), sp_array_value( $_POST, 'sp_past_team', array() ) ) );
}
}
}