Today I would like to show you how to easily build your own plugin which will manage UI for PODS framework. As Pods is considered a plugin for more experienced users I would consider my tutorial a bit advanced too.

I am a fan of building static classes which can be easily maintained and extended whenever we need it. Why static class? Well – in most cases we will not need fully bloated object approach and multiple object instances so static class is ideal pick for clean and readable code. This is my  way of writing functionalities for WordPress – not only the ones based on PODS but for all functionalities in general.  There are many other, better or worse, possible ways of handling that – the choice depends on your preferences, experience and situation.


First of all  please install Pods plugin. Then please  import this package so you will have the same basic pods setup as me.


For some reason import is not working as expected and you need to go to books pod setup and select correct relationship for book_author (related to authors) and book_genre (related to genres).

Lets start working.

In my solution we will be building a plugin so this is regular approach as You can find it in WordPress Codex Please refer back to this document if you need more explanation.

First of all we have to create two directories like:

  •  /wp-content/plugins/lg-pods-plugin/
  • /wp-content/plugins/lg-pods-plugin/class/

The next step is to place an index.php file in there:

Working with our class

Now there is time for a little bit more advanced things. Please go to class sub-folder and create LGPodsAdmin.php file:

Unfortunately, due to time constraints I cannot go through the code line by line. I also think that this tutorial should give you an idea how you can use Pods UI and WordPress plugins API to build your functionalities, not necessarily being a copy-paste resource. I have tried to comment code a lot though so you should very easily get a grasp of whats going on.

I have also included a small bonus – a fake function which loads data from external source and creates dynamic description for stock field on edit screen. That is maybe not the nicest example and usage case of how you can build dynamic UI but this should also give you a feel of what is possible when building UI.

This is just a base, simple setup but its easily extendable – I have plugins with 6-8 classes, each working on different aspects of the site, providing various methods.

That is all for today – if you have any comments or questions – just drop me a line.

Related posts

Posted by Kamil Grzegorczyk Owner / Development

  • Hello, I tried importing the package and got the following error:

    Error: Cannot create new field; SQL: ALTER TABLE wp_pods_authors ADD COLUMN name VARCHAR(255); Response: Duplicate column name ‘name’

    I reset pods just to make sure – but it still didn’t work

  • OK scratch that – despite the error the pods were set up anyway. I’ll plug on with the tutorial 🙂

    • lowgravity

      If You encounter any problem – just give me a sign 🙂

  • Trisha Salas

    So very cool…I just discovered pods and I am intrigued by the performance data. I was a bit at a loss how to utilize them but your tutorial has helped so much…it helps to get out of the ‘WordPress’ mindset. Thank you so much for sharing!

  • desmotse

    Nice thanks a lot for this. Could you extend it to display on the frontend the pods ? I’m getting some trouble with the frontend part of pods.

    • Kamil Grzegorczyk

      Unfortunately I’m not using pods on the frontend so I’m not planning any tutorial like this in the future.

  • Michael Brinson

    I’ve been looking in the pods 2.0 documentation and haven’t been able to find anything on which fields are available to include in the $object->ui[fields] array. I looked through the variables listed here -> but it’s not clear what variable names we can use when using this $object->ui[fields] method.

    Any hints as to where you found this information? (I’m guessing you just found it in the code.. in which case.. any file->line number information?


    • Kamil Grzegorczyk

      Well yes – all my information goes from code analysis. If you would like to get more information about what parameters are available for you and what they really do then please investigate PodsUI class

      • Michael Brinson

        Thanks for that Kamil. Not sure why I couldn’t find that before. So, it looks like we have
        “reorder” and
        available. (found on line 116)

        • Kamil Grzegorczyk

          Well yes – but please remember that Scott is addding new functionalities with every plugin release so not all of them can be supported at the moment.

  • Eliot Berriot

    I just wanted to thank you a lot for this tutorial (and all the things you write about Pods).
    It’s clear, re-usable, well-commented and understandable and, last but not least, it works ! That’s perfect for a beginner in WordPress plugin writing, like me.

    • Kamil Grzegorczyk

      Thank you 😉

Like what you see?

Contact us today and get started!