Barry Hughes WordPress Developer

You are browsing posts tagged “PHP”.

WordPress, Nginx and 404 pages for .php files

15 January 2018

Nginx all setup and correct? Check! WordPress installed and ready to go? Check! 404 Not Found pages all working as expected? Almost 😐.

If you’re finding that attempts to access bring you to a nicely crafted, theme-generated and possibly witty 404 Not Found page but (note that *.php file extension) takes you to a rather starker looking Nginx-generated 404 page, then you have a few options that include just living with it.

Assuming for consistency’s sake however that the only option you really want to shoot for is to have non-existent *.php files take you a WordPress 404 page then what you’re probably looking for is the error_page directive.

WordPress, Nginx and missing get/query data

1 November 2017

Hit a curious problem lately where PHP was unable to “see” the query args being passed in via the URL … in other words, the $_GET superglobal was mysteriously empty when it should not have been.

In this specific scenario, I was looking at a view generated by a plugin which was designed to return a list of posts. Various query args could be applied to this view in order to filter the list, but in my case – in the context of my local dev environment – it stubbornly refused to do so. The URL looked a lot like this example:

(That arguably unnecessary trailing slash at the end of the path, by the way, is a result of WordPress and its canonical redirect behaviour.)