The issue at first glance appears to be here..
add_action('game_edit_form_fields', 'game_form_fields');
add_action('game_add_form_fields', 'game_form_fields');
function game_form_fields($tag,$taxonomy) {
Your function is expecting 2 vars to be passed from the hook, but your add_action
calls default to 1..
Eg, this..
add_action('game_edit_form_fields', 'game_form_fields');
Is equal to this..
add_action('game_edit_form_fields', 'game_form_fields', 10, 1 );
The fourth parameters sets how many arguments your callback function can take, and the default is 1, so that’s all your function ever receieves. Updating those add_action
calls to the following should fix it..
add_action('game_edit_form_fields', 'game_form_fields', 10, 2 );
Hope that helps..
Follow-up #1
Maybe the hook isn’t passing a second variable, instead of the previous change, try update the function line to read..
function game_form_fields( $tag ) {
Perhaps that will fix it..