I found out that I forgot to implode the array values on public function job_dashboard( $atts )
function. Updated code below:
private function get_job_dashboard_query_args( $posts_per_page = -1, $post_status = null, $category = null ) {
$post_status_array = [ 'publish', 'expired', 'pending', 'draft', 'preview' ];
if (!$post_status) { // if not set
$post_status = $post_status_array;
}
$job_categories = $this->get_job_categories_all;
if ($category) {
$category = explode(",", $category);
} elseif (!$category) {
$category = $job_categories;
}
$job_dashboard_args = array(
'post_type' => 'job_listing',
'post_status' => $post_status, // [ 'publish', 'expired', 'pending', 'draft', 'preview' ],
'ignore_sticky_posts' => 1,
'posts_per_page' => $posts_per_page,
'orderby' => 'date',
'order' => 'desc',
'author' => get_current_user_id(),
'tax_query' => array( // tax_query = taxonomy query, queried under $wpdb->term_taxonomy
array(
'taxonomy' => 'job_listing_category',
'field' => 'slug',
'terms' => $category,
),
),
);
if ( $posts_per_page > 0 ) {
$job_dashboard_args['offset'] = ( max( 1, get_query_var( 'paged' ) ) - 1 ) * $posts_per_page;
}
return apply_filters( 'job_manager_get_dashboard_jobs_args', $job_dashboard_args );
}
public function job_dashboard( $atts ) {
...
$categories_all_array = $this->get_job_categories_all();
$new_atts = shortcode_atts( [
'posts_per_page' => '25',
'post_status' => [ 'publish', 'expired', 'pending', 'draft', 'preview' ],
'category' => implode(",", $categories_all_array), // output: item1,item2,item3 ...
], $atts );
$posts_per_page = $new_atts['posts_per_page'];
$post_status = $new_atts['post_status'];
$categories_all = $new_atts['category'];
wp_enqueue_script( 'wp-job-manager-job-dashboard' );
ob_start();
$jobs = new WP_Query( $this->get_job_dashboard_query_args( $posts_per_page, $post_status, $categories_all) );
...
}