However a syntax error is being reported when I add the code to my functions.php file:
Your PHP code changes were rolled back due to an error on line 16 of file wp-content/themes/toolset-starter-child/functions.php. Please fix and try saving again.
menu_order isn't a supported field in terms of the standard fields you can include in a Toolset Form.
You would need to include a fake menu_order field (a generic field which could have a menu_order slug), and you would then use the cred_save_data hook to take the value of that generic field and use it to update actual menu_order field of the newly published post.
I can display the field in the form now but when I come to update the functions.php file I get a syntax error, which is odd because it must have worked before on an old website that we no longer have.
Any pointers appreciated.
function my_menu_order_action($post_id, $form_data)
// if a specific form
$my_post = array(
'ID' => $post_id,
'menu_order' => $_POST['menu-oder'],
// Update the post into the database
wp_update_post( $my_post );
I have tried the same PHP codes you provided above in a fresh WP installation + the latest version of Toolset plugins, it works fine, I can save it into theme file "functions.php", see my screenshot functions-codes.jpg