Developer hooks
JobRelay was built with WordPress developers in mind and as such provides a number of customisable options for developers to work with to make customisations.
The connector plugin added to WordPress has a number of hooks and filters which developers can use to run their own code and change values at various different places. Below is a brief overview of the most useful.
JobRelay filters
The following hooks are available.
jobrelay_wpcon_job_data( $job_data )
This filter fires before any data is processed. It allows developers to manipulate the data arriving in WordPress before it is processed. The filter is passed the following arguments:
$job_data
– this is the array of job data from the posting service
jobrelay_wpcon_insert_job_post_args( $args, $job_data )
Allows developers to change the arguments used in the wp_insert_post()
call when before the new job is created.
The filter is passed the following arguments:
$args
– these are the arguments that are used for the call towp_insert_post()
when adding the new job post.$job_data
– this is the array of job data from the posting service
jobrelay_wpcon_update_job_post_args( $args, $job_post_id, $job_data)
After a new job is saved to WordPress, it is updated in order to update the jobs URL, based on the newly assigned post ID. This filter allows developers to modify to arguments used in the call wp_update_post()
when this happens. The filter is passed the the following arguments:
$job_post_id
– this is the ID of then newly created job post$job_data
– this is the array of job data from the posting service
JobRelay actions
The following action hooks are available.
do_action( 'jobrelay_wpcon_job_inserted', $job_post_id, $job_data );
This action fires directly after a new job has been inserted into WordPress, but before any taxonomy term or meta data has been saved. It is passed the following arguments:
$job_post_id
– this is the ID of then newly created job post$job_data
– this is the array of job data from the posting service
do_action( 'jobrelay_wpcon_meta_added', $job_post_id, $meta_key, $meta_value, $job_data );
Fires directly after job meta data is successfully saved. It is passed the following arguments:
$job_post_id
– this is the ID of then newly created job postmeta_key
– the meta key of the saved meta datameta_value
– the value of the meta data just saved$job_data
– this is the array of job data from the posting service
do_action( 'jobrelay_wpcon_job_term_added', $job_post_id, $job_tax_terms, $taxonomy, $job_data );
Fires directly after job taxonomy term data is successfully saved. It is passed the following arguments:
$job_post_id
– this is the ID of then newly created job post$job_tax_terms
– the term names just added$taxonomy
– the name of the taxonomy the terms where added to$job_data
– this is the array of job data from the posting service
do_action( 'jobrelay_wpcon_job_inserted_complete', $job_post_id, $job_data );
This action runs after the job, its meta data and taxonomy terms have all be processed and added to WordPress. It is passed the following arguments:
$job_post_id
– this is the ID of then newly created job post$job_data
– this is the array of job data from the posting service
do_action( 'jobrelay_wpcon_job_deleted', $update_post_id, $job_data );
Fires directly after a job has been deleted. It is passed the following arguments:
$
– this is the ID of deleted job postupdate_post_id
$job_data
– this is the array of job data from the posting service
Further reading
- Take a look at some code examples, showing how to use these actions and filters for different tasks.