Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm about to embark on creating a new WP that, at the core, will rely on a custom post type. I'm building this plugin for a client, but plan to make it flexible enough to release in the future. My client has a specific need for the plugin and I ultimately want it to be flexible enough to meet the needs of many users. As such, I plan to create an admin area where a user can enter the various args that would go into the register_post_type function. My thoughts in doing so are that the end user will be able to leverage the power of my plugin while also being able to preciously control the custom post type that the plugin generates. I like the idea of easily giving this control over to non-technical users; however, my concern is that I could invite a number of potential issues by doing so. For instance, imagine that a user uses the interface to name the custom post type "whirly-doos", but later thinks that's a dumb name and decides to call it "howdy-doos". This could potentially orphan their previous custom post types.

So...my questions are: is this a good way of going about building this plugin? How would you implement the plugin and maintain a nice balance between customization and stability?

Thanks in advance!

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

I would not give them control over the actual name of the post type. What if they rename it to revision or attachment? Big time site wreckage potential there.

I'd say stick with the more "trivial" things; basically, only those things that don't go into the database: labels, rewrite settings (although that could be potentially hazardous in the hands of an uneducated user), menu icon, menu position, exclude from search, and supports.

I think allowing GUI management of those things would give the user the most flexibility without compromising stability.

share|improve this answer
    
I like the idea of seriously considering what I would and wouldn't offer them control over. I really want a person who, for instance, must change 'has_archive' to 'true', to be able to do so, but perhaps that's not what I need to be doing. So far, I think I might hard code the internal name of the post-type. There is no need for that name to ever change. I would them give them control over the labels so the appearance can change. Great input John! –  tollmanz Apr 29 '11 at 2:21
add comment

I guess there are already some plugins out there that do stuff like you mentioned. Here's one example.

share|improve this answer
    
Thanks kaiser. I'm actually not looking to build a custom post type plugin. Rather, I'm building a plugin that does something very different; however, I plan to have a customizable custom post type that will be necessary for the rest of the plugin functionality. –  tollmanz Apr 29 '11 at 2:07
    
You are right John! I'm just interest in how others would approach the problem of offering customizability of the singular custom post type in my plugin while making sure that these changes don't cause issues with the performance of the plugin –  tollmanz Apr 29 '11 at 2:08
    
@Sardine Oops, I deleted my comment between your comments, since your first comment confirmed my supposition. –  John P Bloch Apr 29 '11 at 2:10
    
@Sardine - in this case i'd suggest to inspect the linked plugin for filters and hooks and build a child plugin that allows locking of specific stuff based on if( current_user_can( 'capability' ) ). –  kaiser Apr 29 '11 at 2:13
    
@kaiser - thanks! That is a good idea. It would save me some time! The purist in me wants to re-invent the wheel though! I appreciate this suggestion and will consider going this route! –  tollmanz Apr 29 '11 at 2:18
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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