| 0 comments ]

Re-Share This Post: Technorati Digg This Stumble Stumble Facebook Twitter
Hi Friends,

Two days ago I was trying to solve one problem in my plugin IGIT Related Posts in which by default it was showing password protected posts so I was trying to make it like it will not show password protected posts in relates posts.It was not a big issue because I have to just insert one condition in sql query but today in this article I just want to give one idea that how can anyone check via PHP code in wordpress that post is password protected or not.


To check that if post is password protected or not then you have to do it via if condition shown below :

<?php
if (!empty($post->post_password)) { // if there’s a password
// This code exceutes if your post dont have password.
}
?>


By this code you can check that post is password protected or not. If you have any problem in this then you can

0 comments

Post a Comment

 
http://www.tsfaenterprise.com TSFA ENTERPRISE TSFA GAS OVEN AND HOME APPLIANCE IN PAKISTAN GAS OVEN GAS OVEN in pakistan Pakistan Home Appliance http://gasovenandhomeappliancesinpakistan.com/ TSFA ENTERPRISE TSFA GAS OVEN AND HOME APPLIANCE IN PAKISTAN GAS OVEN GAS OVEN in pakistan Pakistan Home Appliance