• How do I intercept WordPress changing the title tag for 404 responses?

    I have a custom 404 page running and I don’t want the response to be “Nothing found for “…

    I have everything else working, my 404 page will handle all of the various post lookups if the requested page can’t be found. I even change the response header to 200 so that as far as the browser is concerned the document returned is valid. My only hang up is that the title tag still reads “Nothing found for “… and it is driving me up the wall…

    I’ll modify core if I have to, although I’d rather just write a function to handle it.

    Thanks for any help….

Viewing 3 replies - 1 through 3 (of 3 total)
  • I even change the response header to 200 so that as far as the browser is concerned the document returned is valid.

    Bad idea! The whole point of a 404 is that it returns a 404 header.

    Other than that, try editing your theme’s template files so that there is nothing in the else part of the Loop.

    Thread Starter feoconsulting

    (@feoconsulting)

    It will return a 404 header if the script that runs on the 404 page doesn’t come back with anything….

    However, using the 404 script to handle processing of requests is actually a pretty handy thing. I’ve used this on several occasions (using pre version 3 code) and it works great.

    The main purpose is to feed URL information into WordPress for processing. In this case we have a large membership database that is OUTSIDE of WP. The links point to /members/John_Smith… there is no page, nor post, that will match that request… so of course WP throws the 404. On the 404 template file we first see if the request is for a “member” profile. If it isn’t we just let WP do its job and send back the standard 404 stuff. If it is a request for a member profile we parse the URL, determine which member the user is looking for, then display the correct data and set the header to 200 as the request is in fact valid.

    All of this works perfectly with the exception that WP is still replacing the page title with “Nothing found for John Smith”… even though the profile is being shown, and the response header is 200.

    Hi feoconsulting,

    I’m having the same problem, that i hope you resolved.
    I’m also using a database outside WP, check if the request concern the outside database, and then display informations with header to 200. Otherwise i let WP do its job.

    But can’t figure out how to change this title “Nothing found for …”

    Did you find a way to solve this ?
    It would be nice !

    If anyone else knows how to do that …

    Thanks for any help

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘change 404 title tag’ is closed to new replies.