Ensure newly created JobRelay jobs are in draft
If you want to ensure that jobs created by JobRelay are set to a post status of draft
rather than publish
, the following code achieves this.
The code can be placed in a plugin, or in your themes functions.php
file.
<?php
/**
* Alters the args passed to wp_insert_post when a job is created.
*
* @param array $args The args passed to wp_insert_post.
* @param array $data The job data sent to the site.
*
* @return array The modified args.
*/
function hd_jobrelay_edit_insert_job_post_args( $args, $data ) {
// set the post status to draft.
$args['post_status'] = 'draft';
// return the args.
return $args;
}
add_filter( 'jobrelay_wpcon_insert_job_post_args', 'hd_jobrelay_edit_insert_job_post_args', 20, 2 );