• Skip to primary navigation
  • Skip to main content
  • Skip to footer

GDS Web Design

Not Just another WordPress Developer

  • Home
  • Portfolio
  • Services
  • Process
  • Blog
  • Contact
  • Go to All
  • Go to Getting Started
  • Go to Tutorials
  • Go to Design and Redesign
  • Go to Updating and Improving
  • Go to Marketing
  • Go to Coding
  • Go to Glossary
  • Go to Announcements
  • Go to Opinion

Adding a custom taxonomy to WP Job Manager

What follows is how to add and use a custom taxonomy with the WP Job Manager plugin for WordPress.

The documentation for the plugin provides some good hints and code examples for adding additional fields – but for a recent project I needed to use a custom taxonomy, so roll your sleeves up and let get started.

The first thing is to define the custom taxonomy.

/**
* Register the skill taxonomy for the job_listing post type.
*
* @since 1.0.0
*/
function gds_create_taxonomy_skill() {
register_taxonomy(
'skill',
'job_listing',
array(
'labels' => array(
'name' => __( 'Skills' ),
'singular_name' => __( 'Skill' ),
'search_items' =>  __( 'Search Skills' ),
'all_items' => __( 'All Skills' ),
'edit_item' => __( 'Edit Skill' ),
'update_item' => __( 'Update Skill' ),
'add_new_item' => __( 'Add New Skill' ),
'new_item_name' => __( 'New Skill' ),
'menu_name' => __( 'Job Skills' ),
),
'hierarchical' => false,
'rewrite' => array('slug' => 'skill'),
)
);

}
add_action('init', 'gds_create_taxonomy_skill');

This creates the skill taxonomy adding it to the job_listing post type. In this case I set hierarchical to false so it behaves just like the default Tags used on regular WordPress Posts.

Next is to add the skill taxonomy to the job submission form used on the frontend of the website, this is done using the submit_job_form_fields filter provided in the plugin. In this case I set the type to use term-checklist but you can use a different field type, take a look in the wp-job-manager/templates/form-fields folder for available types.

/**
* Add skill field - frontend.
*
* @since 1.0.0
*/
function frontend_add_skills_field( $fields ) {
$fields['job']['skill'] = array(
'label'       => __( 'Required Skills', 'job_manager' ),
'type'        => 'term-checklist',
'required'    => true,
'placeholder' => 'Choose skills candidates should possess.',
'priority'    => 5,
'taxonomy'    => 'skill',
);
return $fields;
}
add_filter( 'submit_job_form_fields', 'frontend_add_skills_field' );

The last piece of the puzzle is to make sure the fields are retrieved when a user goes from previewing their job listing back to editing it on the frontend of the website. Again, there’s a filter available submit_job_form_fields_get_job_data to hook into.

/**
* Retrieve the skill field when submitting/previewing on the frontend.
*
* @since 1.0.0
*/
function frontend_retrieve_skills_data( $fields, $job ) {
$fields[ 'job' ][ 'skill' ]['value'] = wp_get_object_terms( $job->ID, 'skill', array( 'fields' => 'ids' ) );
return $fields;
}
add_filter( 'submit_job_form_fields_get_job_data', 'frontend_retrieve_skills_data', 10, 2);

The site I was working on uses a custom child theme of mine, so I chose to add this code to the child themes’ functions.php file, but this could just as easily be placed in a site specific plugin to keep it persistent if themes are switched.

October 7, 2018 by Gary Filed Under: Coding

  • Go to NEXT
  • Go to ALL
  • Go to PREVIOUS

Signup to Email Post Alerts

And I'll let you know when I publish something new.
Loading

Reader Interactions

Comments

  1. Fernando Ayala says

    April 29, 2019 at 7:30 pm

    Is it possible to use these custom wp job manager functions you used on user accounts instead of on job posts?

    • Gary says

      November 13, 2019 at 5:58 pm

      No, these are specifically for the job_listing post type and related jobs submission fields.

Footer

Recommended

  • FAQ
  • Testimonials
  • Contact

Trending

  • Web design for Chichester telephone business
  • Website Design for Interior Accessories Shop
  • Website design for Hog Roast business
  • Website Re-Design for Custom Marine Parts Business
  • Wedding photographers website design
  • Website Design for Recruitment Business

Recent Projects

Website Redesign for Trinsic

Website for Sportsboat World

Website Makeover for Hooves and Love

Website for Hampshire Cleaning Company

Website Upgrade for Decor Books

View more of my work

Copyright © 2011–2026 GDS Web Design · Legal Notice · Locations

Website by gds-code-icon [Converted] GDS Web Design