[wp-trac] [WordPress Trac] #14914: Potential Bug in wp_update_term() when using get_term filter

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 20 23:48:02 UTC 2010


#14914: Potential Bug in wp_update_term() when using get_term filter
--------------------------+-------------------------------------------------
 Reporter:  jfarthing84   |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:  3.0.1          
 Severity:  major         |    Keywords:  dev-feedback   
--------------------------+-------------------------------------------------
 Here's the situation: I am using the "get_term" filter to automatically
 load other related term objects.

 For instance, I have a "widget" taxonomy that is related to the "factory"
 taxonomy. I store the "factory" ID in the "widget" term taxonomy meta
 table I have created. Then, using the "get_term" filter, I automatically
 load the "factory" term object as a property of the "widget" term object.

 The problem arises when wp_update_term() is called with an object as a
 property of the term because of the call to add_magic_quotes() call on the
 term immediately. It expects strings only.

 This seems like it defeats the purpose of the "get_term" filter if I can't
 add to the object without crashing WP.

 So, in order to prevent this from happening, there should be some kind of
 filtering mechanism when wp_update_term() is called, as to only pass the
 default term properties into the validation functions. Perhaps even a
 "pre_update_term" filter would work, called before get_term() so that the
 "get_term" filter could be removed before hand.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14914>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list