jobrelay_wpcon_get_job_by_reference_args hook

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

  • $args array
    The current array of args used in the query
  • $ref string
    The job reference being queried to find a job with that reference

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 );

All docs

Can’t find what you need?

Our integrations team set up every JobRelay site, so they know it inside out. Get in touch and we’ll help.