apply_filters( ‘jobrelay_wpcon_get_job_by_reference_args‘, $arg array, $ref string )

In this article

Filters the arguments used to query for a job with a specific reference.

Parameters

More information

This allowed developers to modify the query args used when querying for a job with a specific reference. The args are passed to the WP_Query and therefore any valid WP_Query args can be used.

Example usage

Check for draft jobs with a job reference as well as published
<?php
/**
 * Ensures that when checking for existing jobs with a reference
 * that we check for both draft and published jobs.
 *
 * @param array  $args The arguments to pass to the get_posts function.
 * @param string $ref The reference to search for.
 *
 * @return array
 */
function hd_jobrelay_edit_get_job_by_reference_args( $args, $ref ) {

	// set the post status to draft and publish.
	$args['post_status'] = [ 'draft', 'publish' ];

	// return the args.
	return $args;

}

add_filter( 'jobrelay_wpcon_get_job_by_reference_args', 'hd_jobrelay_edit_get_job_by_reference_args', 10, 2 );