Migrating Plugins and Themes to 2.6

跳转至: 导航搜索
includeonlydiv style=clear:both; background-color:#FFFFFF; border:1px solid #FFFFFF; color:#000000; padding:7px; margin:0.5em auto 0.5em auto; vertical-align:middle;span style=float:left; margin:4px/spanThis article, written to accord with WordPress 2.6, is now obsolete. Please take caution when following its contents, as many things may have changed./div/includeonlynoinclude


This Template is used by Codex:Template Messages.


pre 检查到模板循环:模板:Message /pre





When a new major version of WordPress is released, such as WordPress 2.1 or 2.2, you may find that your Themes and Plugins no longer work the way you are used to. It could be that they are completely broken, because something in WordPress that was fundamental to them changed, but it's also possible that you can get them working again by updating some settings, or maybe just a small edit.

This article is part of a series on Migrating Plugins and Themes. It covers changes between WordPress Version 2.5 and Version 2.6, and what you need to do to Plugins and Themes to get them working in Version 2.6.

If you are the author of your Theme or Plugin, or if you have modified or customized your Theme, then this article will help you upgrade your Theme/Plugin for 2.6. If your Theme or Plugin is distributed publicly, after getting it working you may want to add it to the Compatibility lists above, so your users will know it is working and which version they should be running.

Fixing Up Your Theme or Plugin

Admin Section Changes

The header of the Admin section changed, and there was a new hook called 'sidemenu' that you could use to add a link to the links on the right side. However, this went away in WordPress 2.7, so it is not recommended that you use it!

Flexible Directories

There is more flexibility about where your uploads, plugins, and language files should go. Some useful constants:

  • WP_CONTENT_DIR - full path
  • WP_CONTENT_URL - full url
  • WP_PLUGIN_DIR - full path
  • WP_PLUGIN_URL - full url - replaces PLUGINDIR
  • WP_LANG_DIR - full path

There are also new options called upload_path and upload_url_path, which give the path and URL to the uploads directory.

For more information and sample code for use in plugins see Determining Plugin and Content Directories.