Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hi I'm running a site that makes heavy use of a custom taxonomy called 'Games' and using the Simple Term Meta plugin the metadata for these terms. Using pretty much a copy of the code from wordheavy.com it's working fine except for two things: it throws an error on the 'Game' taxonomy page (Warning: Missing argument 2 for game_form_fields() in ommitted/functions.php on line 32) and when you add a 'game' the form doesn't clear.

You can find a copy of my code here.

I'm not quite where to start (apart from line 32!) so any direction would be appreciated.

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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..

share|improve this answer
    
Hey there, That (rather unfortunately) doesn't seem to have made a difference :/ –  Co-Op Reviews Apr 9 '11 at 17:10
    
You're still seeing the message? Are you sure you saved the change? Can't see what else it could be, and that's the exact problem the error message relates to(i'm about 99.9% sure of that).. –  t31os Apr 9 '11 at 17:13
    
Yep changes saved, same message, and cached cleared. –  Co-Op Reviews Apr 9 '11 at 17:20
    
See update in answer. –  t31os Apr 9 '11 at 17:35
    
That would appear to be it! Thanks very much! –  Co-Op Reviews Apr 9 '11 at 18:00
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.