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.

I'm getting this error every time I add an item (page, post or category) to my menu system:

Warning: Invalid argument supplied for foreach() in /home/rootname/public_html/wp-admin/includes/plugin.php line 1261

I also can't insert links to internal pages from within the WYSIWYG editor (no pagesappear in the list).

I guess it could be a theme-server conflict issue as I have an identical set up (same theme, plugins etc) on my localhost which is working ok, it's just the live site that is having issues...

Any ideas of what I should do?

Thanks,

Osu

EDIT

Ok, I've found the root of the problem - it's to do with a function in my functions.php file:

/* Remove admin end options */
add_action( 'admin_init', 'osu_remove_menu_pages' );
function osu_remove_menu_pages() {
    remove_menu_page('link-manager.php');
    remove_submenu_page('themes.php', 'themes.php');
    remove_submenu_page('themes.php', 'widgets.php');
    remove_submenu_page('plugins.php', 'plugin-editor.php');
    remove_submenu_page('users.php', 'user-role-editor.php');
    // remove_submenu_page('index.php', 'update-core.php');
}

I'm using it to remove some options on the admin end and would prefer to keep this function if possible just to make the admin end less cluttered. Can anyone see why that might be conflicting with the link system in WP 3.2.1?

Thanks

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

i also had this problem. the problem is that you are adding action to *admin_init* ... try something like this:

add_action( 'admin_menu', 'remove_unused_menus' );
function remove_unused_menus() {
remove_menu_page('link-manager.php');
remove_menu_page('edit-comments.php');
}

notice the use of *admin_menu* instead of *admin_init* some require admin_init...but i forget which/why.

share|improve this answer
    
Thanks @bristweb, that seemed to sort it for me too. I'll read up on which ones need admin_init –  Osu Sep 25 '11 at 11:08
add 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.