[wp-hackers] wp list pages and password protected pages
MichaelH
justmichaelh at gmail.com
Thu May 8 21:49:29 GMT 2008
From: "Joost de Valk" <joost at joostdevalk.nl>
Sent: Thursday, May 08, 2008 5:05 PM
> On May 8, 2008, at 11:04 PM, JAYMIN PATEL wrote:
>>
>>> -----Original Message-----
>>> From: joost at joostdevalk.nl
>>> Sent: Thu, 8 May 2008 22:55:07 +0200
>>> To: wp-hackers at lists.automattic.com
>>> Subject: [wp-hackers] wp list pages and password protected pages
>>>
>>> Hi,
>>>
>>> Is there any way to make wp_list_pages exclude password protected
>>> pages? If not, how would I do that most efficiently?
>>>
>>> Cheers,
>>> Joost
>>>
>> <?php wp_list_pages('exclude=1,2'); ?>
>>
>> where 1 & 2 are page_ids of password protected pages.
>>
>> - JK
>
> That's not what I'm looking for, I need a more generic solution :)
>
$password_pages = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE
post_status = 'publish' AND post_type = 'page' and post_password !=''");
wp_list_pages('exclude=' . implode(",", $password_pages));
MichaelH
More information about the wp-hackers
mailing list