Forums

Hide admin pages in menu (6 posts)

  1. Daniel Chatfield
    Member
    Posted 8 months ago #

    I need to create some admin pages that can only be accessed when linked to or redirected to by my plugin. For example:

    There will be a change log page which will be redirected to after updating. The page will have the slug "[pluginslug]_change_log". I don't want this page to appear in the menu as it only needs to be accessed after an upgrade. I know i could hide it with CSS but that isn't ideal.

  2. nsathees
    Member
    Posted 8 months ago #

    Either use include or Exclude with wp_list_pages

    http://codex.wordpress.org/Function_Reference/wp_list_pages

  3. Daniel Chatfield
    Member
    Posted 8 months ago #

    Does that work for admin pages? I am talking about the administration pages not front-end pages.

  4. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

    No it doesn't. Sometimes people respond without reading the original question properly.

    Do you really have to generate this as an extra page? Only eShop handles this by outputting the changelog as part of the update notice so that users get to see what's changed before they upgrade..

  5. Daniel Chatfield
    Member
    Posted 8 months ago #

    I dont have to but I was just wondering whether you could hide a page. I know that if you register all the hooks that wordpress usually does for you it does work (i've managed to get that working) but an update is likely to break that as you shouldn't be messing around with those hooks.

  6. Big Bagel
    Member
    Posted 8 months ago #

    Instead of creating an entirely separate page to show your change log, you could have your current page show it based on if a certain query variable is set. For example:

    function display_my_plugin_page() {
        if ( intval( $_REQUEST[ 'show_changelog' ] ) == 1 ) {
            /* Show change log */
        } else {
            /* Your normal plugin page */
        }
    }

    Then, when you want to show the change log, you can just append show_changelog=1 to your plugin page's URL query string. This function might help in this case:

    http://codex.wordpress.org/Function_Reference/add_query_arg

    If you really want an entirely separate page, you can try using this function to remove it from the menu:

    http://codex.wordpress.org/Function_Reference/remove_menu_page

Reply

You must log in to post.

About this Topic