0

This SQL code will disable pingbacks on old posts and pages:

UPDATE wp_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'post';
UPDATE wp_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'page';

I am looking to disable comments and pingbacks on all of my old custom post types.

Also by default I noticed Wordpress allows comments on new pages. Is there a way to fix this?

  • Your question is "How can I run this SQL only for old post types?" What is the definition of an "old post type"? – s_ha_dum May 5 '14 at 22:58
  • An old custom post type is any "custom post type" post that has already been published. I need to run SQL code to disable comments and pingbacks everywhere.. – Joanna Mikalai May 5 '14 at 23:03
  • Well, post types don't get published. Posts in a post type get published. Is that what you mean? – s_ha_dum May 5 '14 at 23:08
  • yes this is what i meant s_ha_dum.. – Joanna Mikalai May 5 '14 at 23:12
  • Let's make it easier. I want to disable comments and pingbacks everywhere in all single posts, custom post types and pages both new and old... I found out how to do this for new posts via the Wordpress options already. – Joanna Mikalai May 5 '14 at 23:40
2

Let's make it easier. I want to disable comments and pingbacks everywhere in all single posts, custom post types and pages both new and old.

You could remove comment support for your post types.

remove_post_type_support( 'posttype', 'comments' );
// for each of  your post types of course

The same can be done when registering the post type, for types that you create yourself. See the supports argument array. Simpley don't include comments in the list.

|improve this answer|||||
  • Hi @s_ha_dum, in my register_post_type for cpt I have this line for supports: array( 'title', 'editor', 'revisions', 'custom-fields', 'post-formats', 'author', 'thumbnail' ) but comments do pop up somehow,, maybe 'cause it's of type 'post' or have general settings to enable comments..? anyways your remove_post_type_support fn line removes tham, thanks! – Kresimir Pendic Jan 5 '15 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.