2

Let's say I want to create a new admin panel for WordPress. Which should be separate from the one we have now. How do you think I should start?

I want to build /wp-admin/ from scratch for administrators. Which means, the new admin panel should have everything /wp-admin/ has. Why need to build a new panel? Because the present one keeps changing, and what I am upto needs an area which is under my control, and not changed by every WP update, but I update it when I want to.

Summary: I want to build root.com/dashboard/ which has everything present at root.com/wp-admin/

How do you propose I begin? What is necessary to make a completely new WordPress admin panel work. Which files, permissions, sessions etc I should be looking at. Looking forward to some pointers from you guys.

  • Sorry if this comes across sarcastic, but you are aware that rebuilding the complete WP Admin from scratch is at least thousands of hours of work for a lot of people? Also just replacing the backend doesn't save you from adapting on each WP update as non-backend stuff might force you to update the backend to stay compatible. All in all - a futile endeavour. – kraftner Jan 29 '15 at 16:53
  • I am trying to design the backend. The problem I face is by every update, the core changes this at the backend, and it breaks my code. So, if I want to design a theme for WordPress admin panel, I though there should be a way to clone it. E.g. if .xyz is a class and I used it to design something at the backend in the admin dashboard of WordPress, there is a chance that in next update of WordPress that class won't be there and my theme will screw up. – Ahmad Awais Jan 29 '15 at 17:00
  • What is the best way you could think of to build a /wp-admin/ dashboard theme? – Ahmad Awais Jan 29 '15 at 17:00
  • 2
    To be really honest, drop your project. The admin area is huge with an enormous amount of classes and functions. Stick with what wordpress offers or look for another platform that might suite your needs better – Pieter Goosen Jan 29 '15 at 17:43
  • You don't get it. I want to build an easier admin panel for WordPress. – Ahmad Awais Jan 30 '15 at 2:06
3

In fact, the WP API (also named WP REST API or WP JSON API aims for that (aside from other goals). You can find the project in the repo and on GitHub.

The "API" mainly provides data access and (CRUD actions) via GET and POST request running to the /wp-json/ request/URi. You can fetch posts, post collections, users, media, comments and meta data for pretty much everything. The thing you don't get is stuff like the importer and other "Tools", Dashboard widgets, theme stuff or plugin activation, etc. Also plugins would have to add their own responses if the plugin is present or you will have to write adapters on your own.

The plugin aims to be part of WP Core with one of the next versions. Currently it's not at the point where that happens, but development continues.

While it's still a long journey to build a replacement for ~/wp-admin, you can simply register a custom endpoint and try to build your own (JavaScript) application there. In the interwebs you will find many pre-made admin interface frameworks (mostly built on top of stuff like Twitters Bootstrap, Foundation, etc.) that should allow you to build a very rough prototype with most admin stuff covered in one or two days (depending on your knowledge):

// Adds the \WP_Rewrite endpoint
add_action( 'init', function()
{
    add_rewrite_endpoint( 'custom-route', EP_NONE );
} );

// Adds your identifier for queries
add_filter( 'query_vars', function( $vars )
{
    $vars[] = 'custom-admin-identifier';
    return $vars;
} );

Make sure to visit the admin > options > permalinks page to flush your rewrite rules after that - or register an activation or deactivation callback that wraps flush_rewrite_rules().

Then you should be able to visit https://example.com/custom-route where you can do whatever pleases you. If you want to load custom templates there, jump in on template_redirect and load them:

add_filter( 'template_redirect', function( $template )
{
    # another option would to check:
    # array_key_exists( 'custom-admin-identifier', $GLOBALS['wp_query']->query_vars )

    if ( get_query_var( 'custom-admin-identifier' ) )
        return plugin_dir_path( __FILE__ ).'templates/index.php';

    return $template;
} );

which would load templates/index.php from your plugin and serve it.

0

You can do it by adding your own management screens while removing he original ones from the menu. You will most likely still want to let the admin see the original screens unless you really want to replace the whole admin with exact equivalent which as all the good people in the comments had said is lots and lots of work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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