[wp-trac] Re: [WordPress Trac] #3875: Proposal for a new plugin architecture

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 31 17:02:24 GMT 2007

#3875: Proposal for a new plugin architecture
 Reporter:  FraT                                                                  |        Owner:  ryan    
     Type:  defect                                                                |       Status:  reopened
 Priority:  normal                                                                |    Milestone:  2.2.2   
Component:  Optimization                                                          |      Version:  2.1.1   
 Severity:  normal                                                                |   Resolution:          
 Keywords:  2nd-opinion plugin plugins plugin.php filters $wp_filter wp-includes  |  
Comment (by santosj):

 It is simple to fix.

 Just check to see that $function_to_add is an array and if it is, then
 take the first key ( $function_to_add[0] ) and see if it is an object or a
 string. If it is an object, then get the name (
 get_class($function_to_add[0]) ) and use that for the serialized part.

 It may decrease the speed a little bit, but it will fix the previous
 issues. And actually, for plugins and internal code that uses functions,
 it won't affect the speed at all (or so in my humble opinion).

 function add_filter($tag, $function_to_add, $priority = 10, $accepted_args
 = 1) {
     global $wp_filter;

     $serialized = &$function_to_add;
             $serialized = array(get_class($function_to_add[0]),

     $wp_filter[$tag][$priority][serialize($serialized)] = array('function'
 => $function_to_add, 'accepted_args' => $accepted_args);
     return true;

 In theory, this should work.

Ticket URL: <http://trac.wordpress.org/ticket/3875#comment:10>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list