admin管理员组文章数量:1194126
What is the wordpress wp-includes folder for? That is, whats the fundamental architectural purpose of it, for example why isn't it all in themes or an admin folder?
Can a plugin developer rely in it's contents (e.g. jQuery) and for how long?
I would also like to know, who decides what goes in there and how does it get maintained as Wordpress changes, any is all this documented somewhere as a policy doc?
What is the wordpress wp-includes folder for? That is, whats the fundamental architectural purpose of it, for example why isn't it all in themes or an admin folder?
Can a plugin developer rely in it's contents (e.g. jQuery) and for how long?
I would also like to know, who decides what goes in there and how does it get maintained as Wordpress changes, any is all this documented somewhere as a policy doc?
Share Improve this question edited Dec 4, 2012 at 16:24 Simon Gibbs asked Dec 4, 2012 at 16:16 Simon GibbsSimon Gibbs 4031 gold badge3 silver badges9 bronze badges5 Answers
Reset to default 21wp-includes
contains everything needed to run WordPress via the frontend ( and then some ). It is the territory of WordPress Core, and as the adage goes, never modify core under any circumstances.
While wp-content
may define plugins and themes, the API itself and the vast majority of the WordPress core sits in that folder. These are depended on by almost the entirety of WordPress. All your standard functions and their dependencies will be found in this folder.
This makes it a valuable resource for research and looking up things.
wp-admin
may define additional items but it is not as vital to the running of the frontend
./wp-admin - Admin code
./wp-content - User-defined code and content
./wp-includes - Common files
As for how reliable the files are in that folder, you shouldn't rely on the files in that folder. You should never need to include a file or path from wp-includes and if you attempt to or need to, then you have done something horribly wrong and need to stop and go back.
While the files in that folder may change without warning, this should be of no consequence, as the API contained is kept backwards compatible for a significant amount of time.
Outside of updates to WordPress, wp-includes
should never be modified and should ideally be read only.
Should you need to add a dependency to your code, rely on the versions in wp-includes rather than adding your own. e.g. don't include a custom jQuery, use the one bundled with WordPress ( don't de-register it and re-register it either ).
Modifications to wp-includes can cause security risks, performance degradation, broken plugins/themes, etc
Changes to the packages and libraries included are announced ahead of releases. Old dependencies no longer required (such as the old colour picker) are kept, but marked deprecated to prevent code breakage
The wp-includes
directory includes the packages that are included by core. The core team maintains the packages included in wp-includes
. Themes and Plugins can rely on those packages being available for any given version of WordPress.
That's a huge reason why it is extremely important to enqueue only core-bundled versions of scripts, using the core-defined script registration, such as: wp_enqueue_script( 'jquery' )
, so that your Theme/Plugin will always be using the version bundled with core, no matter what version of WordPress is running.
WordPress, as an application, is built of several moving parts. The /wp-includes
folder contains common functionality for the WordPress API (which you use in themes/plugins) and the WordPress admin.
So, basically:
./wp-admin - Admin code
./wp-content - User-defined code and content
./wp-includes - Common files
The /wp-includes
directory is where useful 3rd party libraries (i.e. SimplePie for RSS and IncutioRPC for XML-RPC) are stored. It's also where much of the WordPress API (i.e. WP_Http, WP_Filesystem) is defined.
Can a plugin developer rely in it's contents? and for how long?
Yes. These files are what defines the WordPress API in the first place. The core team goes to great lengths to retain backwards compatibility, so if any changes are ever introduced in WordPress that will break what you're using, you'll know aobut it well beforehand.
I would also like to know, who decides what goes in there and how does it get maintained as Wordpress changes, any is all this documented somewhere as a policy doc?
Decisions for WordPress' API are defined by the development team. You can usually follow changes on http://make.wordpress.org/core. Libraries are always maintained since changing these libraries is what changes WordPress.
wp-includes
is the directory that contains most of WordPress' main functionality. It's where all the major WordPress code lives.
WordPress does an excellent job of maintaining backwards compatibility between versions. You can use the functions included in this folder to build plugins with (that's how you hook into the system).
WordPress Trac is the main area that decides how WordPress moves forward, so if you have opinions/additions, get involved there :)
The Make WordPress Core handbook has a handy page titled The WordPress Codebase, which provides a good overview of How Code In WordPress Is Organized, including:
wp-includes
The wp-includes directory consists of the primary core and third-party libraries for WordPress. Many of these files are loaded as the application is bootstrapped.
The files in wp-includes go by a (mostly) standard set of prefixes and suffixes:
- class-*.php – PHP classes. Some of these are external libraries.
- ms-*.php – Code specific to WordPress multisite functionality.
- default-*.php – Code that implements or defines default functionality, namely constants, widgets, and filters.
- *deprecated.php – Functions which are deprecated.
- *-template.php – Template functions for the relevant API.
The files in wp-admin/includes follow similar naming conventions.
and
wp-admin/includes
The wp-admin/includes directory consists of the primary core and third-party libraries available and used in the administration area. Some of these are loaded as the admin is bootstrapped; see wp-admin/includes/admin.php for the primary list of files included.
and more... check it out 2022 peoples! :-)
本文标签: plugin developmentWhat is the wordpress wpincludes folder for
版权声明:本文标题:plugin development - What is the wordpress wp-includes folder for? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738480637a2089123.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论