[wp-hackers] Adding meta data to categories

Mike Schinkel mikeschinkel at gmail.com
Thu Jan 8 23:18:03 GMT 2009


Dan:

I would add records to wp_terms & wp_term_taxomony like this  (in raw SQL):

SET @term_id:= 3;
INSERT wp_terms (term_id,name,slug,term_group) VALUES (@term_id,'Category
Tags','category-tags',0);
INSERT wp_term_taxonomy term_id,taxonomy,parent,count) VALUES
(@term_id,'category_tag',0,0);

 *Note that the "3" this assumes you are using a default install of WP2.7
where you have only two terms, use whatever the largest term_id you have in
the the wp_terms table + 1.*

Once you have this then just add a record to wp_term_relationships for each
tag that you apply to a category where the object_id should be set to the
term_id for the category being tagged and the term_taxonomy_id should be set
to the term_id of the tag that you want to apply to this category.

This sounds like a very useful plugin, I could even use on my current
project.  Will you release to the community after you develop it?

-Mike Schinkel
http://mikeschinkel.com/custom-wordpress-plugins/


On Thu, Jan 8, 2009 at 4:18 PM, Dan Gayle <dangayle at gmail.com> wrote:

> One of the sites that I have been working uses custom fields extensively
> for things like <meta> tags, sidebar information, etc. The main issue that
> we are running into is that we want the same flexibility for category/search
> pages. So my main question is, What is the best way to add custom meta
> fields to non-posts/pages?
> The categories page in the admin doesn't appear to have any hooks that we
> could latch onto to create extra inputs, and if we figure out that part,
> which database table would be the best table to add the info to?
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>


More information about the wp-hackers mailing list