[wp-trac] [WordPress Trac] #11059: Discourage plugin authors calling wp-config.php directly
WordPress Trac
wp-trac at lists.automattic.com
Thu Nov 5 22:40:45 UTC 2009
#11059: Discourage plugin authors calling wp-config.php directly
-------------------------+--------------------------------------------------
Reporter: strider72 | Owner:
Type: enhancement | Status: reopened
Priority: normal | Milestone:
Component: General | Version: 2.9
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+--------------------------------------------------
Comment(by josephscott):
If a plugin wants to do something like output custom CSS based on options
set via wp-admin then hook into query_vars (there are other methods
specifically to support custom CSS as well, just using this as the
example). Given the tremendous amount of flexibility now possible in WP
for moving and re-naming wp-content, theme and plugin paths, wp-
config.php, etc. trying to pull in wp-config.php, wp-load.php, wp-blog-
header.php is virtually guaranteed to break in some installs of WP. Using
the query_vars hook will always work across all installs.
Will Norris has a good write up about this (saved me from writing one) -
http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-
to-plugin-files
I've looked at enough submissions to the WPORG theme directory to tell you
that trying to pull in wp-config.php, wp-load.php, wp-blog-header.php,
etc. directly is fraught with peril. Given that solution A (query_vars
hooks) works for all WP installs and solution B will break in some
installs, solution B should be discouraged in any way possible.
Having worked with numerous theme authors to address this issue I have
pretty strong feelings about it :-)
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11059#comment:14>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list