Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

4 Answers

up vote 8 down vote accepted

wp-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

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
    
Not the files define the API, the functions and classes in those files do that. The files might move or vanish without any changes to the API. –  toscho Dec 4 '12 at 16:25
add comment

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 :)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.