nSurface

Protecting content in custom themes

If you password protect an individual post or page in your wordpress blog, wordpress makes sure that anything returned by the_content() stays hidden from prying eyes. But what if your theme makes use of other functions that might show something else that you want to remain secure (think attachments, metaboxes, etc)? We’ll it’s not in the wordpress conditionals page, but it does exist:

if(!post_password_required()){
//your protected stuff
}

anything inside that if statement should only show up if your user logs into that post.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>