Last active
August 29, 2015 13:57
-
-
Save mikejolley/9554215 to your computer and use it in GitHub Desktop.
WP Job Manager - Change post_name when posting a job via the frontend.
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
add_filter( 'submit_job_form_save_job_data', 'custom_submit_job_form_save_job_data', 10, 5 ); | |
function custom_submit_job_form_save_job_data( $data, $post_title, $post_content, $status, $values ) { | |
$job_slug = array(); | |
// Prepend with company name | |
if ( ! empty( $values['company']['company_name'] ) ) | |
$job_slug[] = $values['company']['company_name']; | |
// Prepend location | |
if ( ! empty( $values['job']['job_location'] ) ) | |
$job_slug[] = $values['job']['job_location']; | |
$job_slug[] = $post_title; | |
$data['post_name'] = implode( '-', $job_slug ); | |
return $data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment