Applications snippets

← Back to Applications

Note: All code examples on this site are provided for developer reference/guidance only and we cannot guarantee that they will always work as expected. 

They are offered as a courtesy and as-is. 

Our support policy does not include assistance with modifying or debugging code from any code examples, and they may be changed or removed if we find they no longer work due to changes in our plugins.

Please use the Code Snippets plugin, rather than adding the code samples below directly to your theme’s functions.php file. That will help ensure that any code errors won’t crash your site, and the changes will not be overwritten when you update your theme.


Redirect when an application is submitted

add_action( 'new_job_application', function( $application_id, $job_id ) {
  if ( is_object( $job_id ) ) {
	// We're in WP core's hook.
	return;
  }
  wp_safe_redirect( home_url( '/page-success-application' ) );
  exit;
}, 999, 2 );

function htdat_job_manager_alerts_alert_schedules ( $schedules ) {
    $schedules['monthly'] = array(
        'interval' => 86400 * 30,
        'display'  => __( 'Monthly', 'wp-job-manager-alerts' )
    );

    return $schedules;
}

add_filter('job_manager_alerts_alert_schedules', 'htdat_job_manager_alerts_alert_schedules');

Deregister application.js

add_action( 'wp_enqueue_scripts', 'remove_application_js' , 11 );
function remove_application_js(){
  wp_deregister_script( 'wp-job-manager-job-application' );
}

Hide ‘hired’ candidates from applications list in Job Dashboard

add_filter( 'job_manager_job_applications_args', 'dj_hide_hired_applications' );

function dj_hide_hired_applications( $args ) {
 $args['post_status'] = array_diff( array_merge( array_keys( get_job_application_statuses() ), array( 'publish' ) ), array( 'archived' ), array( 'hired' ) );
 return $args;
}

Change the From: details for the Applications Employer notification

add_filter('create_job_application_notification_headers','dm_job_application_headers');
function dm_job_application_headers($headers) {
    $headers[] = 'From: ' . 'My Custom From Name' . ' <example@example.com>';
    return $headers;
     }, 'htdat_job_manager_alerts_alert_schedules');

Change the From: details for the Applications Candidate notification

add_filter('create_job_application_candidate_notification_headers','dm_job_candidate_application_headers');

function dm_job_candidate_application_headers($headers) {
    $headers[] = 'From: ' . 'My Custom From Name' . ' <example@example.com>';
    return $headers;
}

Add hooks for pulling data from an external database

/**
 * Perform actions that need to be done after a new application added.
 *
 * @since 2.5.3
 *
 * @param int $application_id ID of the added application.
 * @param int $job_id ID of the job which user applied for.
 */
do_action( 'job_manager_applications_new_job_application', $application_id, $job_id );