Enable loading of the WordPress environment from external php script
|Reported by:||mp2300||Owned by:|
For some integration projects, it is useful to load the WordPress environment from an external php script. This can be done by including wp-load.php
Afterwards all the WordPress functions can be used.
This is only possible if wp-load.php is included from the global scope. If it is included from inside a function, it will fail. This limitation makes it difficult to integrate WordPress with other projects.
wp-load.php fails because of the use of global objects and assign by reference. A simple solution would be to declare $wpdb, $wp_widget_factory, $_wp_deprecated_widgets_callbacks for global in wp-settings.php
The creation of WP_Widget_Factory in wp-settings.php needs to be changed from
$wp_widget_factory =& new WP_Widget_Factory();
$wp_widget_factory = new WP_Widget_Factory();
The syntax for creation of WP_Widget_Factory should be conditioned by the PHP version, to maintain backwards compatibility with PHP 4.
Change History (7)
- Keywords needs-patch close added; assign by reference removed
- Milestone changed from Unassigned to Future Release
- Type changed from enhancement to feature request
comment:5 c3mdigital — 7 months ago
- Keywords needs-patch close removed
- Resolution set to wontfix
- Status changed from new to closed