Skip to content

Tareq Hasan

CRUD Generator for WordPress

I have written countless number of plugins in the last 7+ years after I started working with WordPress and created other web applications. No matter what type of applications you are building, simple or complex, small or big, one thing is common, you have to insert some data into the database, fetch them, update them and list them. We simply call it CRUD operation.

As I primarily work with WordPress, mostly I have to do this:

  1. Register an Admin Menu
  2. A Callback Function for Listing the Items → WP_List_Table
  3. Add New Form → Handle the submission, insert items into database
  4. Update Form → Handle the submission, update items in database

It’s boring….!

A few days ago I was working on a project that requires multiple database tables and guess what, I have to do the tasks listed above for EVERY SINGLE TABLE. Are you serious? I have to write all those codes again and again for every table. I simply couldn’t get my head around that idea of writing the codes, as a result I was stuck and no progress was being made on that project. We are programmers, we are lazy people, how could we do such a waste of energy doing the same thing?

I had to come up with a solution, I didn’t want to write the same thing every time I build a plugin. So, as always, the generator was made, out of frustration and laziness of course :D

Here is a quick demo of the working project:

View Demo Fork in Github

19 thoughts on “CRUD Generator for WordPress”

  1. was amazing ... I 've tried to like in the video tutorial , but only empty display only. Can I be given an example file ?? so they can find out what is wrong to follow video tutorials . thank's

  2. @dewah - I understand your frustration; the video does move rather quickly. I went through it pausing the screen frequently and making notes of what was happening, especially what/where files are being created.

    If you're getting a blank screen chances are you encountering a fatal php error; turn debug on to see the error. In my case I forgot to place a leading "/" in from of the pathname in an include statement.

  3. Hi! someone has publish the delete function on github, but it is imcomplete! Can you please update it? Thank you

  4. wow, really interesting but the lack of better usage instruction is inexcusable.
    author should have put together a quick readme or similar document to make it easier to use instead of the video. or simply just zip up the sample plugin he created in the video so we can see where files go and how they are called.
    If you are going to share than share with love.

  5. I had the same problem, look for the file class-admin-menu.php line 56 and just add an else like this to the file exists where it includes the template

    if (file_exists($template)) {
    return include $template;
    } else {
    echo "View file not found";
    }

    my problems was in filenames and with this you can have the error...