Question re: the API
-
Tonight, I sat down with the impression that I could write a quick and dirty WP plugin. Not that I’ve ever done this before, mind you, but the goal of the plugin seemed so simple that I’m surprised that it hasn’t been done before. In fact, I’m sure it has.
The idea was to make a plugin that would print different error messages based on what was requested of the database. For every different case, as of the default installation, you get the message “Sorry, but not posts matched your criteria” (or what have you). When I designed my site, I was able to make different messages for the following cases:- When a yearly archive is requested, and there is no post for that year.
- When a monthly archive is requested, and there is no post for that month.
- When a daily archive is requested, and there is no post for that day.
- When a category archive is requested, and there is no post associated with that category.
- When the weblog is searched, but there are no posts that contain that search query.
- When a post is requested, but that post does not exist.
Which, given the perfectionist I can be, shouldn’t be surprising to anybody.
However, when I got down to actually writing the thing, I encountered some problems. I got it to more or less work when viewing weblog pages, but the administrative pages were completely unaccessible. Error messages to the effect of “header already sent.”
Perhaps it has something to do with the API, and that there aren’t any filter or action hooks specifically associated with the error message. So I don’t really know. Like I said, I’ve never played with the API before, so I’m almost positive it’s related to that.
Any comments? Source code will be posted shortly. Thanks for any help, in advance.
The topic ‘Question re: the API’ is closed to new replies.