• Resolved waffeltje

    (@waffeltje)


    Good morning,

    I’m using the plugin Code Snippets to add custom fields to job_listings. Now, I’m receiving the following php error:

    Error message: Cannot redeclare custom_submit_job_form_fields() (previously declared in /var/www/vhosts/xxx/wp-content/plugins/code-snippets/php/snippet-ops.php(469) : eval()’d code:6)

    There is a conflict between WP Job Manager and the snippet I added (I’ve added numerous custom job fields using snippets and they used to work fine).

    I’m adding custom fields using the two follOwing snippets:

    add_filter( 'job_manager_job_listing_data_fields', 'admin_add_stageniveau_field' );
    function admin_add_stageniveau_field( $fields ) {
      $fields['_job_stageniveau'] = array(
        'label'       => __( 'Opleiding', 'job_manager' ),
        'type'        => 'select',
    	'options' => array('MBO' => 'MBO', 'HBO' => 'HBO', 'Universiteit' => 'Universiteit', 'Anders' => 'Anders'),
        'placeholder' => '',
        'description' => ''
      );
      return $fields;
    }
    add_filter( 'job_manager_job_listing_data_fields', 'admin_add_startdatum_field' );
    function admin_add_startdatum_field( $fields ) {
      $fields['_job_startdatum'] = array(
        'label'       => __( 'Startdatum', 'job_manager' ),
        'type'        => 'select',
    	'options' => array('Z.s.m.' => 'Z.s.m.', 'Flexibel' => 'Flexibel', 'Z.s.m. & flexibel' => 'Z.s.m. & Flexibel', 'Oktober 2020' => 'Oktober 2020', 'November 2020' => 'November 2020', 'December 2020' => 'December 2020', 'Januari 2021' => 'Januari 2021', 'Februari 2021' => 'Februari 2021', 'Maart 2021' => 'Maart 2021', 'April 2021' => 'April 2021', 'Mei 2021' => 'Mei 2021', 'Juni 2021' => 'Juni 2021', 'Juli 2021' => 'Juli 2021', 'Augustus 2021' => 'Augustus 2021', 'September 2021' => 'September 2021'),
        'placeholder' => '',
        'description' => ''
      );
      return $fields;
    }

    Any suggestions how to resolve this error? The error seems to be around the WP Job Manager hook custom_submit_job_form_fields() (https://wpjobmanager.com/document/editing-job-submission-fields/).

    Thanks in advance.

    Bèrke

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support bindlegirl (a11n)

    (@bindlegirl)

    Hi Bèrke ( @waffeltje ) !

    We won’t be able to help troubleshoot custom code pre our Support Policy.
    That being said, the Cannot redeclare.. error means you are using the same function twice and yous shouldn’t do that.

    Plugin Support Jay

    (@bluejay77)

    Hi there,

    It has been more than one week since we have heard from you, so I’m marking this topic as resolved.

    But if you have any further questions or need some more help, you’re welcome to reply here or open another thread.

    Thread Starter waffeltje

    (@waffeltje)

    Good morning,
    Sorry for the late reply. Indeed, the function custom_submit_job_form_fields() was existing twice. After renaming one of the functions the problem was resolved. Thanks @bindlegirl for your advice.
    Regards.

    That’s great to hear! Thanks for letting us know.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Error message: Cannot redeclare custom_submit_job_form_fields()’ is closed to new replies.