[wp-hackers] Disable comments on pages post type

Gavin Pearce Gavin.Pearce at 3seven9.com
Thu May 26 16:57:05 UTC 2011


If you have any pages setup already, it's worth running:

UPDATE `wp_posts`
SET comment_status='closed'
WHERE post_type='page'

else you'll find some pages will still display the comments RSS feed in
the header etc ...

Gavin



-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Robert
Lusby
Sent: 26 May 2011 15:22
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Disable comments on pages post type

Hi Chris, John,

Thanks! Though removing the comment line from page.php would still show 
the comments box in the back-end however, hence the problem.

I'll try your method John, and report back on results.

Thanks again,
Rob

On 26/05/2011 15:19, Christopher Ross wrote:
> Hi Rob, John's point that remove_post_type_support( 'page', 'comments'
); will remove them is a great way to do it, except that it adds code to
the work WP has to do as opposed to removing the line takes away from
the workload.
>
> I'd just open page.php and remove the comment line if you never want
it to be seen.
>
> Chris
>
> On 2011-05-26, at 10:53 AM, Robert Lusby wrote:
>
>> What's the "best practise" way to disable comments support on the
"page" post types?
>>
>> When creating a custom post type, you specify:
>> register_post_type('example', array('supports' =>
array('title','comments')));
>> thus creating the comments functionality on the front-end, and the
back-end. Removing this, would remove the comments box from the
back-end, as well as not accepting posts on the front-end.
>>
>> How do you modify the page post type to disable comments support?
>>
>> I know you can obviously just "untick" the box under discussion, but
I'm looking to remove "comments" support from "page" post types
altogether ...
>>
>> TIA,
>> Rob
>>
>>
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
> __
>
> Christopher Ross
> Online Portfolio - http://christopherross.ca
> Personal Blog - http://thisismyurl.com
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list