[wp-trac] [WordPress Trac] #37656: Improve plugin bootstrapping processes with `WP_Plugin`

WordPress Trac noreply at wordpress.org
Tue Aug 16 13:24:46 UTC 2016


#37656: Improve plugin bootstrapping processes with `WP_Plugin`
-------------------------+------------------------------
 Reporter:  flixos90     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Plugins      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by jdgrimes):

 Replying to [comment:3 swissspidy]:
 > While `register_plugin()` and an additional interface sounds
 interesting, I do not think anyone would use it because of backward
 compatibility with older WordPress versions. Who wants to basically
 maintain two versions of their plugin?

 Sometimes this kind argument makes sense for a feature, and sometimes it
 doesn't. Just because plugins might not be able to take advantage of a
 feature right away doesn't mean that it isn't core material. There was a
 time when plugins couldn't use the action/filter API because of back-
 compat. :-) Same goes for every single other thing introduced to core.
 However, I do see your point that asking a plugin to implement an
 interface means that they would have to maintain two different classes,
 since the interface is required, but in older versions of WordPress
 wouldn't exist. It isn't a feature that can be wrapped in an `if` version
 check, it's all or nothing.

 Or is it?

 {{{#!php
 <?php
 class Foo_Plugin {}

 if ( interface_exists( 'WP_Plugin_Interface' ) ) {
    class Foo_Plugin_With_Interface implements WP_Plugin_Interface {}

    register_plugin( __FILE__, 'Foo_Plugin_With_Interface' );
 }
 }}}


 That said, I agree that this has to be done slowly and by increments.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37656#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list