Skip to content

Instantly share code, notes, and snippets.

@jom
Last active June 27, 2019 10:22
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 jom/f0f14a53d100f118cb1450690807f37c to your computer and use it in GitHub Desktop.
Save jom/f0f14a53d100f118cb1450690807f37c to your computer and use it in GitHub Desktop.
WPJM: Add Custom Post Status
add_action( 'init', function() {
global $job_manager;
register_post_status( 'needs_changes', array(
'label' => _x( 'Needs Changes', 'job_listing', 'custom-code-text-domain' ),
'public' => false,
'exclude_from_search' => false,
'show_in_admin_all_list' => false,
'show_in_admin_status_list' => true,
'post_type' => array( 'job_listing' ),
'label_count' => _n_noop( 'Needs Changes <span class="count">(%s)</span>', 'Needs Changes <span class="count">(%s)</span>', 'custom-code-text-domain' ),
) );
add_filter( 'job_listing_post_statuses', function( $statuses ) {
$statuses['needs_changes'] = _x( 'Needs Changes', 'job_listing', 'custom-code-text-domain' );
return $statuses;
} );
add_action( 'needs_changes_to_publish', array( $job_manager->post_types, 'set_expiry' ) );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment