[wp-hackers] Best practice: access plugins php files
peter.westwood at ftwr.co.uk
Wed Aug 11 09:07:09 UTC 2010
On 11 Aug 2010, at 03:57, Lox wrote:
> 2010/8/11 John Blackbourn <johnbillion+wp at gmail.com>:
>> I personally use the following to get the location of my plugin:
>> $plugin_dir = WP_PLUGIN_URL . '/' . basename( dirname( __FILE__ ) );
>> Then your file would be at:
>> $plugin_dir . '/help.php?field=password';
> I know how to get the url to my plugins, thks.
> So it seems the best practice is to access plug-ins scripts directly
> when needed. I was just wondering if there was a sort of wrapper to
> achieve it. Seems there is not. Thanks.
Best practise for this is to access the file directly if you don't need any WordPress functionality.
You should use plugins_url() to get the url to a file.
plugins_url( __FILE__, 'help.php?field=password');
This way you are covered for custom wp-content locations, https and other things that might change in future
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5
More information about the wp-hackers