[wp-hackers] Best Way

Mike Schinkel mikeschinkel at newclarity.net
Thu Jun 25 03:24:56 GMT 2009


So I'm about to polish up my first plugin that I'll actually be releasing (from the 20+ I've written for my own projects, most of which I hope to eventually release) and I've got a simple question. 

My plugin needs to use functions in /wp-admin/includes/bookmark.php which are not included by default. I have the following line at the top of the file but it feels like a hack: 

require_once(ABSPATH.'/wp-admin/includes/bookmark.php'); 

Is there a better way to do this vs. hardcoding? 

Also this plugin requires another plugin (I'm developing these plugins in part as real-world examples of the dependent plugin issues we were recently discussing on this list.) This is the code I have to include the other plugin's code to ensure they are loaded in the correct order, which also feels like a hack: 

if (!class_exists('WP_Options')) 
require_once(plugin_dir_path( __FILE__ ) . '../wp-options/wp-options.php'); 

Any suggestions for either? Thanks in advance. 

-Mike Schinkel 
Custom Wordpress Plugins 
http://mikeschinkel.com/custom-wordpress-plugins 


More information about the wp-hackers mailing list