Page 1 of 1

Help with php code please

Posted: Tue Mar 29, 2016 7:05 pm
by daveharte
Hi, Im trying to add this code to execute this tutorial explained here https://wpjobmanager.com/document/tutor ... -for-jobs/ under "Add the field to the frontend"

I cant seem to get it to work. I tested the code online in several sources and receive an error "FATAL ERROR Call to undefined function add_filter() on line number 2"

Code: Select all

<?php
add_filter( 'submit_job_form_fields', 'frontend_add_salary_field' );
function frontend_add_salary_field( $fields ) {
  $fields['job']['job_salary'] = array(
    'label'       => __( 'Salary ($)', 'job_manager' ),
    'type'        => 'text',
    'd'    => true,
    'placeholder' => 'e.g. 20000',
    'priority'    => 7
  );
  return $fields;
}
Any help greatly appreciated. Thanks

Re: Help with php code please

Posted: Tue Mar 29, 2016 8:33 pm
by Celauran
add_filter is defined in WordPress. That's a WordPress tutorial. Are you trying to use this as standalone code?