[wp-hackers] category hack

deko deko822 at hotmail.com
Mon Apr 16 03:02:15 GMT 2007


How to get additional data in $_category object?  (v. 2.1.3)

In wp-includes/category.php (line 149) the get_category function uses this SQL 
to create a $_category object:

$_category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = 
'$category' LIMIT 1");

I've added 3 fields to the categories table (for a new plug-in I'm working on) 
which are designed to be administered from the admin pages.  When a category is 
created or updated, I want 3 additional pieces of information in the categories 
table.  So I've modified the wp-admin/edit-category-form.php accordingly, and 
also the wp_insert_category in wp-admin/admin-db.php (lines 124 and following).

The problem is my $_category object does NOT get the new data from the 
additional table fields.  Am I missing something?  Shouldn't that 'SELECT *' 
statement get my new data from the additional table fields?  Is the 
apply_filters function filtering it out?

Thanks in advance.



More information about the wp-hackers mailing list