• What happened to the functions that adds administrative menus? I always used add_management_page on functions.php, but now it is not working any more since I upgraded to WP2.6.2. And even if I copy everything to a new plugin file it keeps saying that I can not redeclare the function used on add_management_page. Yes, I deleted the same function from functions.php, but it did not fixed it. And the function I am using is not beeing declared twice. The code:

    function test_function() {
    echo 'OK';
    }
    function test_head() {
    add_management_page('Test', 'Test', 7, __FILE__, 'test_function');
    }
    add_action('admin_head', 'test_head');

    Fatal error: Cannot redeclare test_function() (previously declared in /canoaviagem.com.br/www/wp-content/plugins/canoaviagem.php:13) in /canoaviagem.com.br/www/wp-content/plugins/canoaviagem.php on line 14

Viewing 1 replies (of 1 total)
  • Thread Starter Rafael Dourado

    (@rdourado)

    Well, I changed action from ‘admin_head’ to ‘admin_menu’ and it worked. But if I want to add more than one menu item, it looks like that I will have to create more than one file for each menu, because the function parameters is not making any difference. If I do something like this:

    add_management_page('Test', 'Test', 7, __FILE__, 'test_function');
    add_management_page('Test 2', 'Test 2', 7, __FILE__, 'sec_test_function');

    Both functions are beeing called at the same time.

Viewing 1 replies (of 1 total)

The topic ‘Problems adding administration menus’ is closed to new replies.