Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function check_jobs_post( $post ){
- if('jobs' != $post->post_type){
- return false;
- }
- // Job Type
- $temp = array();
- $taxs = isset( $_POST['tax_input']['job-type'] ) ? $_POST['tax_input']['job-type'] : array();
- $taxonomies = json_encode( $taxs );
- $tax_array = json_decode( $taxonomies, true );
- if ( is_array( $tax_array ) ) {
- foreach ( $tax_array as $key => $tax ) {
- if ( count( $tax ) <= 1 ) {
- array_push( $temp, $tax );
- }
- }
- }
- // Insdustry Type array
- $ind_temp = array();
- $industry = isset( $_POST['tax_input']['industry'] ) ? $_POST['tax_input']['industry'] : array();
- $industries = json_encode($industry);
- $ind_array = json_decode($industries, true);
- if(is_array($ind_array)){
- foreach ( $ind_array as $key => $value ){
- if(count($value ) <= 1){
- array_push( $ind_temp, $value );
- }
- }
- }
- // Company
- $company = isset($_POST['company_tax']) ? $_POST['company_tax'] : array();
- if ( count( $temp ) > 0 && count( $ind_temp ) > 0 ) {
- $post->post_status = 'draft'; // use any post status
- wp_publish_post($post);
- } else {
- $post->post_status = 'publish'; // use any post status
- wp_update_post( $post );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement