[wp-hackers] find wp-config from a plugin file

Abel Cheung abelcheung at gmail.com
Sun Feb 3 18:51:30 GMT 2008

On Jan 29, 2008 9:12 PM, Jacob Santos <wordpress at santosj.name> wrote:
> I finally understood what purpose having more than one dirname() has and
> well you don't need it. The same can be solved doing this: <?php
> require_once( realpath( dirname(__FILE__) .'/../../wp_config.php'); ?>.

Completely unusable if the plugin directory is symlinked to another location.


> I would have to suggest that you first check whether the file exists two
> folders above you and if it doesn't, then check if it is three folders
> above you. However, since ABSPATH can be anywhere in relation to where
> your plugin is, I would say, just record ABSPATH and just call that path
> for AJAX. It would add some overhead, but you'll be right every time.
> Not sure how the user will feel having their full path stored in the
> database though. I wouldn't mind myself.
> What in the WordPress API, do you need?
> Jacob Santos
> --
> Jacob Santos
> http://www.santosj.name - blog
> http://funcdoc.wordpress.com - WordPress Documentation Blog/Guide Licensed under GPLv2
> Also known as darkdragon and santosj on WP trac.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

Abel Cheung   (GPG Key: 0xC67186FF)
Key fingerprint: 671C C7AE EFB5 110C D6D1  41EE 4152 E1F1 C671 86FF
* My blog: http://me.abelcheung.org/
* Opensource Application Knowledge Assoc. - http://oaka.org/

More information about the wp-hackers mailing list