XML Import

In WPJobBoard you can import (and somewhat manage)  jobs, applications, candidates and employers via API or from file, however regardless of method you will be always sending XML file in specific WPJobBoard XML scheme, the example file you can download here.

Importing From File

If you need to do a bulk job import, you can do that from WPJobBoard Import panel. In wp-admin go to Settings (WPJB) / Import / XML File Import, select file from your computer and click Import.

It is possible to import one XML file or a couple of XML files inside a zip file.

Importing via API

For users experienced with programming, it is possible to manage import via API, to do that you will need an account with “import” capability, you can use your admin account, however for security reasons it is recommended to create a new user with just “import” capability.

Running import with API is as simple as making a POST request to WP site, please see PHP code below:

$site = 'http://my-domain.com/';
$username = "user_with_import_capability";
$password = "plain_text_password";
// xml that will change title for job with id=63
$xml = "<wpjb><jobs><job><id>63</id>";
$xml.= "<job_title>My new title</job_title></job></jobs></wpjb>";

// import setup
$path = 'wp-admin/admin-ajax.php';
$url = $site.$path;
$data = array(
 'username' => $username, 
 'password' => $password,
 'xml' => $xml,
 'action' => 'wpjb_import_api'

$options = array(
 'http' => array(
 'header' => "Content-type: application/x-www-form-urlencoded",
 'method' => 'POST',
 'content' => http_build_query($data),

$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$result = simplexml_load_string($result);

// parsing results
foreach($result->import as $import) {
  $type = (string)$import->type;
  $title = (string)$import->title;
  $action = (string)$import->action;
  echo "$action $type: $title<br/>";
  if(is_array($import->messages->message)) {
    foreach($import->messages->message as $message) {
      echo "- " . (string)$message->text."<br/>";
  echo "<br/>";

That is pretty much it, in the script above you only need to change variables $site, $username, $password and $xml content. The script should work on any server PHP5 installed.

For reference, the reply you will receive when sending an import request will look similar to the one below

  <action>insert</action> <!-- insert | update | fail -->
  <title>Job Title</title>
  <admin_url>Job Title</admin_url>
      <type>warning</type> <!-- warning | fatal -->
      <text>Some warning message</text>
<!-- more imports here -->
  1. Hi Greg,
    I need to add the above code to entrylevelminingjobs.com.au, they have a new partner who has a feed, i have the usernames and passwords, my question is simple where do i add the above code, to a job board template or a WP file?

    • Greg

      This code should be added somewhere in a separate file, it is meant to be used for “standalone” import mechanism.

  2. Hi I’m trying to xml upload my users but when I add the xml file as at the top of this page, excel tells me the xml source file does not refer to a schema.
    When mapping and exporting it then does not move my data.
    can you help?

    • Greg

      Hi, it seems that there is an error in the XML file you are trying to import, unclosed tag for example.

  3. I have over 2k worth of jobs I need to import. Editing in a spreadsheet is the easiest and saving to .csv for import is desired. However, when I import the file, it does not save my job type or category. I used the headers job.category and job.type. When I view the job listings index, they are blank. What am I doing wrong?

  4. Hi,
    Why can I not select a .xml file to upload? It is grayed out on my browser. The only way to upload a file is to zip it up.

Leave a Reply

Your email address will not be published. Required fields are marked *