I'm having an issue with one site in which my plugin is installed. The "settings" page will not load. When I click on "settings", it loads the settings page but the page is blank after the "Upgrade to 3.1" nag div as if there was a die() there.
I have two files, plugin.php and plugin-admin.php
I've got code in plugin.php to set up the admin page:
$my_dir = plugins_url('/img', __FILE__);
add_options_page(
'MY! Settings',
'MY! Settings',
'manage_options',
'my-plugin-admin.php',
'my_settings_admin',
$my_dir.'/favicon.png', 'top'
);
register_setting( 'my_settings_options', 'my_settings', 'my_settings_validate' );
function my_settings_admin(){
global $wp_rewrite;
$wp_rewrite->flush_rules();
include_once dirname(__FILE__) . '/my-plugin-admin.php';
}
define( 'my_BASENAME', plugin_basename( __FILE__ ) );
define( 'my_BASEFOLDER', plugin_basename( dirname( __FILE__ ) ) );
define( 'my_FILENAME', str_replace( my_BASEFOLDER.'/', '', plugin_basename(__FILE__)));
The "My Settings" link shows up under the "Settings" menu fine, and the link appears to be going to the correct page, but the script does not load and nothing will trace inside of my-plugin-admin.php
Any ideas?
UPDATE: with t31os help, here's the updated function that fixes the problem:
function my_settings_admin(){
include_once dirname(__FILE__) . '/my-plugin-admin.php';
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
I simply had to move the wp_rewrite and flush rules after the include statement. Although I don't know why.