Created
March 22, 2024 10:21
-
-
Save jmabbas/2c702ff9a2d79ee2275720b4b7702ec3 to your computer and use it in GitHub Desktop.
Mas company - skip preview step
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function custom_submit_company_steps( $steps ) { | |
unset( $steps['preview'] ); | |
return $steps; | |
} | |
add_filter( 'submit_company_steps', 'custom_submit_company_steps' ); | |
function change_preview_text() { | |
return __( 'Submit Company' ); | |
} | |
add_filter( 'submit_company_form_submit_button_text', 'change_preview_text' ); | |
function done_publish_company( $company_id ) { | |
$company = get_post( $company_id ); | |
if ( in_array( $company->post_status, array( 'preview', 'expired' ) ) ) { | |
// Update company listing | |
$update_company = array(); | |
$update_company['ID'] = $company->ID; | |
$update_company['post_status'] = get_option( 'company_manager_submission_requires_approval' ) ? 'pending' : 'publish'; | |
$update_company['post_date'] = current_time( 'mysql' ); | |
$update_company['post_date_gmt'] = current_time( 'mysql', 1 ); | |
wp_update_post( $update_company ); | |
} | |
} | |
add_action( 'company_manager_company_submitted', 'done_publish_company' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment