Mapping JobRelay fields to WordPress data

Data arrives at your WordPress site from JobRelay through the JobRelay endpoint. You can see a full list of the data by viewing the JobRelay field listing.

When the data arrives, the JobRelay connector plugin will attempt to save this data in WordPress, based on the mappings created in the plugins settings screen.

This article outlines how to create mappings to make sure the data is saved as you want it, in the correct place in WordPress. Mappings are required, because everyone’s WordPress site is different. Some may have a bespoke job board solution, whereas others will have used something off-the-shelf.

How can I save the JobRelay data?

When a job arrives, a new post is created in WordPress. This post is created in the post type entered on the sites settings screen. The additional data, sent with the jobs, for example salary, can be saved in one of two ways:

  1. Post meta – the values can be saved as meta data, stored against the newly created job post.
  2. Taxonomy terms – the values can be saved as specific terms in a given taxonomy. If the term does not exist already, it is created first and then assigned to the job.

Meta mappings

The meta mappings section of the settings screen, is where we tell JobRelay which values we want to save as meta data, and which meta keys to save them as.

Meta mappings are entered in the JSON format and consist of a key and value pairing. The key is the meta key to save the value against and the value is the name of the field in the JobRelay feed.

Take a look at this example:

{
    "_salary":"salary"
}

This instructs JobRelay to save the value sent over in the salary field as meta data using the meta key named _salary.

Taxonomy mappings

Instead of saving data as meta data, you may want to save it as terms within a given taxonomy. This makes sense if you want to more efficiently search for jobs based on this data.

Like the meta mappings, taxonomy mappings are also added in the JSON format and consist of a key value pairing. The key is the taxonomy name and the value is the name of the field in the JobRelay feed.

Take a look at this example:

{
    "job_listing_category":"job_industry"
}

This instructs JobRelay to save the value sent over in the job_industry field as a term in the job_listing_category taxonomy. The connector plugin checks to see if there is an existing term with the sent value as its name. If there is that term, gets assigned to the job. If no terms exists with that value, a new term is created before being assigned to the job.

What about the job title, description and short description?

These are always saved for each job without the need to map the data. This is because the job title is saved as the job post title (post_title), the job description saved as the job post content (post_content) and the short description saved as the job post excerpt (post_excerpt).