Posts Tagged ‘3.0’

add_menu_page on WP 3.0 Thelonious

lundi, juin 28th, 2010

Just a quick note to plugins developpers. The options page for the Welcome Announcement stopped showing after the upgrade to WP 3.0. After few checks, it appears the bug comes from the function: add_theme_page.

Previously, I used the following call:

add_theme_page ('Welcome Announcement Options', 'Welcome Announcement','administrator', url_of_the_php_file_containing_the_function, 'wa_options_page');

It appears that in 3.0, the system doens’t like the « http:// » prefix of the URL. In fact, i don’t even need to give the reference to the php file. A simple « slug » is enough.  From the codex:

The slug name to refer to this menu by (should be unique for this menu). Prior to Version 3.0 this was called the file (or handle) parameter. If the function parameter is omitted, the menu_slug should be the PHP file that handles the display of the menu page content.

So, if you give the name of the function, no need to give the reference to the php file. A simple id / name for the slug suffices.

Hope it helps!