WordPress Action Hook Field Type

You can now create new fields in WP Job Manager Field Editor that trigger actions by using the WordPress Action Hook field type.

To do this simply create a new field, set the field type to WordPress Action Hook and then you can output anything you want whenever that field gets executed to be displayed.

As an example, if your META KEY for the field was job_example_action, this would be the action you need to use:

All actions start with  job_manager_field_actionhook_

An example action that would be added to your functions.php file would be something like this:

For more details on adding actions in WordPress please see:
https://codex.wordpress.org/Function_Reference/add_action

Validate

If you want to validate the custom field you have added, you would need to use the  submit_job_form_validate_fields filter, and return WP_Error object if there is an error (to prevent moving on to next step).

Updating Listing

Custom action hooks do not save any type of values to the listing, that would need to be done manually as well using the  job_manager_update_job_data action for the frontend and  job_manager_save_job_listing for when listings are saved/added from WP Admin area.

Total 3 Votes

Tell us how can we improve this post?

+ = Verify Human or Spambot ?