Help with php code please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
daveharte
Forum Newbie
Posts: 1
Joined: Tue Mar 29, 2016 6:58 pm

Help with php code please

Post 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
Attachments
Capture.PNG
Capture.PNG
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Help with php code please

Post by Celauran »

add_filter is defined in WordPress. That's a WordPress tutorial. Are you trying to use this as standalone code?
Post Reply