Chris Jean's Blog

Linux, WordPress, programming, anime, and other stuff.
twitter
rss
Jul
03

Important changes in WordPress 2.6

Categories : Development

WordPress 2.6 allows for moving the wp-content folder and the wp-config.php file. Some code guidelines have been published to help developers standardize their plugins with the new changes. The following code will allow code to work with current versions and the upcoming 2.6.

wp-content

  1. // Pre-2.6 compatibility
  2. if ( !defined(‘WP_CONTENT_URL’) )
  3.     define( ‘WP_CONTENT_URL’, get_option(’siteurl’) . ‘/wp-content’);
  4. if ( !defined(‘WP_CONTENT_DIR’) )
  5.     define( ‘WP_CONTENT_DIR’, ABSPATH . ‘wp-content’ );
  6.  
  7. // Guess the location
  8. $plugin_path = WP_CONTENT_DIR.‘/plugins/’. plugin_basename(dirname(__FILE__));
  9. $plugin_url = WP_CONTENT_URL.‘/plugins/’. plugin_basename(dirname(__FILE__));

wp-config.php

  1. $root = dirname(dirname(dirname(dirname(__FILE__))));
  2. if (file_exists($root.‘/wp-load.php’)) {
  3.         // WP 2.6
  4.         require_once($root.‘/wp-load.php’);
  5. } else {
  6.         // Before 2.6
  7.         require_once($root.‘/wp-config.php’);
  8. }
Tags: ,

Share This Post

Related Posts

Receive Updates

New posts on gaarai.com delivered directly to your email.

Email:

Leave a Reply