• i would like to know the proper way to do this

    $dynValue=5;//loop this name times
    //start of my loop
    for ($num=1; $num <= $dynValue; $num++){
    
    //note the incremented number ($num) in the call back
    add_action('add_meta_boxes', 'mpc_meta_box_'.$num.');
    
    //below is where im having the problem
    // i am trying to increment this function name so i will not get the error that "function name has already been declared". i cannot add '.$num.' in the func name below cause its not valid php.
    function mpc_meta_box_'.$num.'(){
    //some content
    }
    
    }//end of my loop
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter gavimobile

    (@gavimobile)

    i can do this with eval() but i know its not recommeneded

    Thread Starter gavimobile

    (@gavimobile)

    i think the add_action function args to be properly configured. if ANYONE can give an example of how i can loop this i would surly be grateful. sorry for the bump.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘need help looping add_action’ is closed to new replies.