WordPress itself is very good blogging system. With small knowlegde you can activate and use plenty of plugins written for it. You doesn't even have to know anything about PHP. But if you want to develop something sofisticated and use provided functions from core it's hell! Lets have a look on how stupid WordPress is written.
We, who work with WordPress know that core contains
one usefull class wpdb to access all neccessary stuff from
WordPress database. But why bother with SQL when all neccesary selects and/or
updates are already written in functions in WordPress core?
Unified API? Forget!
When I wrote this new theme, I decided to write also better unified OO API for retrieving neccesary data from database. But instead of easy modularity I found a rock.
Half of the functions echo data they gather, but only half of
them have getter functions that return their data. The remaining
quarter are functions with/without getter functions but they enable you to
choose whether they have to echo or return. Nice!
I managed only with 2 classes I wrote →
Comments and Comment to eliminate all comment*
functions from WordPress core. Any advantage you ask? Oh yes! I could
stop to use messy HTML+PHP templates and connect all comment templates to ANY
templating engine like Smarty, separate
logic from views and also to cache generated templates to save time when
gathering data from database that haven't changed.
Mess in the functions
Another problem is with function names. Generally you have function
the_title() which echoes (or returns; You can choose it as
parameter of the function) title with all filters applied. And you have function
get_the_title() which only returns title. It's quite simple
the_* functions echo its data, get_the_* functions
return its data.
But, then you have function the_permalink() for echo and
get_permalink()for return. Who the hell is supposed to remember
this?
Updates and plugins
Next thing that sucks in WordPress are updates. Previous version of this site was built on WordPress 2.1 after update to 2.2 some of the plugns just stopped working and had to be uninstalled. The best of all plugins which I had to uninstall was Category tagging by Michael Woehrer. I just couldn't let go and tried to find out why suddenly it stopped working.
Problem was of course in WordPress 2.2. core. Plugin used
list_cats() function which is marked as deprecated in
2.2 version and instead of returning it's data (as in version 2.1) it
now uses wp_list_cats() function which of course echo gathered data
thus making anything that used list_cats() and was modifiing data
structure it returned unusable.
The Solution
So at the end you have only few choices how to get out from this mess…
- Deep study of WordPress core (not only by WordPress Codex)
- Stop using WordPress .)
- Wait until September '07 to try my first release candidate of OO WordPress Templating Engine for PHP5
Have you got similar problems while using WordPress? Share them here, maybe together we can find a good solution!