0

I'm building a plugin that contains a simple editor for a particular file format. This will only be accessible in the admin menu's for the plugin, no frontend access. I've started looking at the actual editor layout and it needs some more real estate on the admin side, so I want to hide the admin menu panels. It would also be cleaner and reduce any unnecessary clutter, like the Gutenberg editor, or the customise theme page. Here's a few options that I'm thinking of:

  • I could make the editor completely full screen and have a "back to WordPress" button to go back to admin screen
  • It could work equally well to hide the left admin menu and leave in the top bar, although this would be a waste of space on mobile.

Are there any built in WordPress functions that hide the admin menu? I think my preferred way to add the editor is to use the add_submenu_page() so that it has it's own page in the menu. However I don't know if there are any standard methods to hide the default admin menu panels on a particular page?

Otherwise I could create the editor in it's own standalone file that the user visits but then I'll have to add a lot of WordPress functions such as checking that the user is logged in, and providing standard WordPress functionality.

I want all the code to be contained within the plugin, so I don't want to edit any pages in wp-admin.

1
  • 1
    There's no built-in function to You will need to use JavaScript (or, any jQuery fullscreen library) to trigger the browser's fullscreen mode. To hide the unnecessary elements, you can toggle a class to the body.
    – Abhik
    Commented Jun 15, 2022 at 9:16

1 Answer 1

0

Per the comments, it doesn't seem there is anything built in for this. I included this code in my page to hide the admin menus:

<style>
    #adminmenumain, #wpadminbar {
        display: none;
    }
</style>

You'll have to muck about with CSS to get your page right. But it seems to work ok.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.