[wp-hackers] Questions - 404 and passworded page
otto at ottodestruct.com
Wed Jan 6 16:08:42 UTC 2010
1. Depends on where you're doing it, but generally
$wp_query->set_404(); does the trick. If you're making your own
output, you can try get_404_template() to see if there is a 404
template to be used. Look closely at how template-loader.php does it.
2. Basically, you need to check the $_COOKIE['wp-postpass_' .
COOKIEHASH] value and see if it's set to your password. If not, then
display what's returned by get_the_password_form() instead. That form
will let the user type in a password, which will call wp-pass.php to
set the cookie, which redirects back to the page afterwards.
On Wed, Jan 6, 2010 at 9:04 AM, Alex Andrews <awgandrews at gmail.com> wrote:
> Dear all,
> A couple of queries that I can't work out even after a fair bit of Googling.
> 1. At the moment my plugin takes some data from a rewrite and
> processes it - ie artist/NAME. If the data isn't found for NAME ie
> there is no artist like this, I want to display a Wordpress templated
> 404 message - how can I do this?
> 2. How can I plug into the passworded post system so I can have a page
> generated by a plugin passworded as with a normal post?
> Thanks very much. If you could point me in the right direction that
> would be great.
> All the best
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers