[wp-hackers] Getting a 404 error when requesting a .php file as a stylesheet in WP 3.0.1

Raj list at expost.org
Tue Sep 7 17:00:45 UTC 2010


I think the appropriate file to include is wp-load.php

include ("../../../wp-load.php");

You do not have to call init() if you're just trying to serve a stylesheet. 

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of David Morris
Sent: Tuesday, September 07, 2010 10:08 PM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Getting a 404 error when requesting a .php file as
a stylesheet in WP 3.0.1

Before I posted this last week I could have sworn that I deleted all of the
code in that file and still received a 404, but I must have been mistaken.
It turns out that the original developer of this theme used this line at the
top of the file:

require('../../../wp-blog-header.php');

That was causing WP 3.0 to throw a 404 error AND serve up the correct
content, which is a weird behavior that causes mixed reactions across
browsers. Anyways, the quick fix I put in was to just replace that line with
this:

@require('../../../wp-config.php');
@$wp->init();

This is obviously not ideal, but I just needed a really quick fix until we
overhaul the theme at a later date. If there is an even better quick fix,
let me know. When we overhaul it, I will be moving to a parent-child theme
approach where style customizations are done in the child theme's style.css
file instead of in a php file.

Thanks for your help guys,

Dave
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list