Support » Plugin: Custom Post Archives » No admin menu item created in WP 3.1.x

  • Resolved Maxime Pedrotti


    There seems to be a problem with integrating the settings page for this plugin within the admin menu — the admin link just does not appear (i.e. there is no entry within the “Settings” menu or any other menu for that matter).

    After going through the code I believe to have found the problem:
    To create the admin menu link the plugin uses the following code (config.php, lines 147 through 150):

    //Add to plugins menu
    if ( current_user_can('manage_options') ){

    According to my research (e.g. the function used here (plugin_action_links) is deprecated since WP 3.1, and the function cannot be found in the WP Codex.

    I would try to resolve the problem myself, but I am not very experienced with plugin coding for WP. Maybe Jacob Dunn can try and update the code himself to make this plugin compatible with the current version of WP.

    BTW: I have not tested the plugin with an earlier version of WP (as in WP 3.0 or below), so I have no information as to whether this issue appears in those earlier versions of WP.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jacob Dunn


    Thanks mp – I took a look to see if that is the issue, but I’m thinking Dr. Brown may be off in this case. The ‘plugin_action_links’ hook still exists, it’s just been moved to the ‘class-wp-plugins-list-table.php’ file in 3.1. It’s also not the hook that’s involved with displaying the admin menu – it’s used to add the ‘settings’ link to the plugin description on your installation’s plugin page.

    The functions used by this plugin to add itself to the admin menu is the hook ‘admin_menu’ on line 31 and the function ‘admin_menu’ on line 166-169 in config.php. If you want to debug, a few print statements around those locations may reveal whether those functions are even being called….

    I’ve also tested this plugin thoroughly in every release client/new release, as it’s very dependent on bleeding edge WordPress developments – don’t want to be caught off guard 😉

    That being said, we DO need to see if we can get the root of your issue – you’re not the first to mention this page not showing up, actually, so I know an issue is being caused somewhere, I just don’t know how to reproduce it. What other plugins do you have in your installation? Any unusual code in the template? Anything used to modify the Admin’s appearance? If it’s not a vanilla install of WordPress, I’m guessing there’s some other influence at work here.

    Hi Jacob,
    OK, my mistake — as i mentioned, i am not very experienced at plugin coding, and the “research” consisted of a quick Google search for the plugin_action_links hook.

    Anyway, back to the issue:
    I have just tested your plugin with a few fresh, unmodified installations of WP (3.0, 3.0.6 and 3.1.2, all once from the original release archive, once from the German WP archive No additional plugins or themes were installed, no changes were made to the admin menu.

    In all these installations, the settings page does not integrate within the admin interface, and there is no “Settings” link on the plugins overview page (the plugin itself is shown with the usual options to activate/deactivate/delete, plus the usual description and links to the author’s website).

    I also tried adding some prints and echoes to the functions mentioned by you, however these do not show up on any page, neither when browsing through admin pages, nor after activating/deactivating the plugin. I also tried this once with WP_DEBUG on and once with it off (should not really be relevant, but I tried anyways).

    Now to an interesting part of my tests:
    For my current project I work locally under Windows 7 with XAMPP. Just to try it out I went and installed the plugin on my live web server, which runs with Ubuntu Linux (8.04), and it worked just fine. So, the issue might not be WP at all, but the OS on which the web server is run (newcom1 had a similar problem described in his thread and he also runs WP on XAMPP for Windows), or maybe the web server (Apache 2.2.17 with PHP 5.3.5 in XAMPP, Apache 2.2.8 with PHP 5.2.4 on my live server).

    Maybe this information helps…

    Plugin Author Jacob Dunn


    Awesome – thanks for the info, mp. I’ve done testing on IIS, and LAMP, but never XAMPP. Tried to keep everything system agnostic, but from what your saying, it appears we’ve got a system-related bug. I’m downloading XAMPP now, I’ll let you know when I find a fix.

    Plugin Author Jacob Dunn


    Wow. Just…Wow. When these server-specific issues come up, it always makes me shake my head. I know that it may be expected behavior, but it still doesn’t make sense, sometimes.

    So, I forced verbose error reporting on XAMPP, and the following errors showed up:

    Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Config.php on line 80
    Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Config.php on line 166
    Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Config\Container.php on line 111

    Long and the short of it is – XAMPP is configured to look in your PEAR includes directory first when using require_once (for whatever reason), and grabbed a Config.php file from there, as opposed to the one in the same directory. I’m now forcing it to use an absolute path, problem solved ;-). Going to have to start doing that as general practice from here on out, if this kind of issue can crop up.

    I’ll be pushing an update later, but if you want to patch it for the interim, here’s the code:

    custom-post-archives.php, Line 120

    // Configuration Page
    // Navigation Menu


    Alright, thanks a lot, that did fix the problem, I now have the “Settings” link in the plugins overview, and the admin menu item shows up.
    Again, thanks for your support! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘No admin menu item created in WP 3.1.x’ is closed to new replies.