Skip to content

Instantly share code, notes, and snippets.

@mikejolley
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikejolley/9554215 to your computer and use it in GitHub Desktop.
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.
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