Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Disable Facebook Comments Automatically On CPT

I ended up going with this type of solution. It seems to be working fine for me. I am open on ways to improve this code as it seems there is a better hook that could be used.

function on_music_publish( $post_ID, $post ) {
    if ( $post->post_type != 'music' ) {
        return;
    }
    update_post_meta($post_ID, '_disable_fbc', 'on' );
}
add_action(  'save_post',  'on_music_publish', 10, 2 );

Related Posts:

  1. How to programmatically create a connection with [Plugin: Posts 2 Posts] on cpt publish?
  2. Can’t publish custom post type – “You are not allowed to edit this post.”
  3. Get only used meta_values
  4. Query all posts where a meta key does not exist
  5. Can the Next/Prev Post links be ordered by menu order or by a meta key?
  6. what is the correct way to compare dates in a WP query_posts meta_query
  7. Advanced search form with filters for custom taxonomies and custom fields
  8. Meta query with boolean true/false value
  9. Get post with multiple meta keys and value
  10. Correctly delete posts with meta and attachments [duplicate]
  11. Storing revisions of metadata for custom post type
  12. Custom field values deleted when trashing custom post type
  13. How to get all custom fields of any post type
  14. Update CPT meta data using REST API
  15. Admin Area Custom Type Search By Meta Fields Without Title & Content
  16. Echo all meta keys of a custom-post TYPE
  17. Custom Post type – how to get checkbox to update meta field to null
  18. How can I filter posts by post_parent in the admin?
  19. How do I Paginate Search Results for Custom Post Types?
  20. Ordering posts having multiple post-meta date fields
  21. Custom Post Type with Input fields to seperate table on database.
  22. How do I remove all the metaboxes for a custom post type?
  23. Customize users’ capabilities to change a custom post’s post status
  24. Custom Queries: Joining On Meta Values From Two Custom Post Types
  25. Gutenberg how to make attribute to save to meta
  26. Post metadata deletes itself
  27. How to create a mini directory in WordPress?
  28. How Can I save multiple records in same meta key?
  29. Get all posts from custom post type and insert in select input as metabox
  30. Detect meta value changes when post is updated (post_updated)
  31. Search everything (posts, pages, tags, cpt, meta)
  32. Permalinks using event date (year & month) instead of publication date
  33. Custom Post Type: Set post_title equal to a custom post type field
  34. I can’t set meta_key in my custom post type query
  35. Grossly inefficient wordpress loops!
  36. Compare 3 custom fields and sort by oldest
  37. How Do I Use WP_Query to Run This Database Query as Search Result?
  38. WordPress Admin Panel search posts with custom post meta values along with title
  39. Creating a custom post type upon registration
  40. How to Update post status using meta data in Custom post TYpe
  41. Rest Api v2 orderby meta_key in custom post type
  42. bulk Update post_meta with default values
  43. Reason action hook won’t work with update_post_meta from frontend form? Alternative?
  44. Can’t sort order of wp_query with 2 meta keys
  45. Showing Meta Data for Custom Post Types?
  46. How to get source of custom meta image?
  47. Having trouble with custom post type / meta box
  48. Query for posts from any post type but only add instock products
  49. How can I include meta box content when searching?
  50. wp_publish_post breaks permalinks
  51. update a post meta from a single table cell TablePress
  52. update custom post type meta from a shortcode
  53. Custom Meta Boxes – Nonce Issue – Move to trash issue
  54. Displaying Meta Box Image
  55. Custom post type category not displaying in custom post type
  56. How to make custom post meta wp_editor translatable?
  57. Automatically adding meta data to posts or multiple query help
  58. How to keep a check box in custom meta box for custom post type checked by default for add new post?
  59. How to add multiple featured image in meta box in post editor?
  60. Show metabox in custom-post-template depending on taxonomy term?
  61. ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
  62. update_post_meta() whenever custom post type is updated
  63. Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
  64. Posts created in a Custom Post Type are lost if published without a title
  65. Trigger “unsaved changes” dialog for custom post meta changes
  66. Using date stored as custom field to filter posts displayed in admin
  67. Conditionally Query Custom Post Types by Post Meta for Blog Home Page?
  68. Displaying custom posts only if custom meta box’s date is not expired
  69. Displaying Metabox value (custom post type taxonomy)
  70. How do I sort a custom post type admin column using two meta keys?
  71. Add Post Url to Manage Edit Screen
  72. Registration and Custom Post Types – How to synchronize information?
  73. How to best delete orphan wp_postmeta
  74. How can I display my custom metaboxes on a custom post template?
  75. Display all custom post type posts and order them by an optional meta_key
  76. Meta Box Only in CPT Edit Page, Not in Add New
  77. get_post_meta is returning image id
  78. Custom Post Type, Saving Multiple Checkboxes
  79. get_template_part() – post-meta not working?
  80. How can I get_post_meta() in the most efficient way?
  81. need advice on how to do a lists using custom post types – taxonomy vs postmeta
  82. Count posts with specific term_meta
  83. Custom search for custom post meta with pre_get_posts interferes with WP search
  84. Create a random unique 6 digit number as custom field for custom post type
  85. Export entries and multiple custom field meta to .csv?
  86. how to interconnect custom post types?
  87. WordPress Orderby Numeric Value Not Working
  88. Custom Post Status Transition Issues With Get Post Meta
  89. Replace title column in post list with post meta value
  90. Metadata for a taxonomy – is there any WordPress way of doing this?
  91. My theme saves their custom post type’s metadata as a serialized array, how to access the keys?
  92. List all images from a single post meta value
  93. Does WordPress limit the length of slug names for Post Meta or Terms?
  94. orderby in custom WP Query does not work
  95. Populate Custom Fields in a Custom Post Type?
  96. Insert Multiple Post with Same Publish Button
  97. Update CPT post meta with update_post_meta and cron job
  98. Custom meta box data array: foreach not working correctly?
  99. Undefined Variable – Custom Post Type Meta
  100. Ordering posts in Search & taxonomy by post_meta
Categories custom-post-types Tags custom-post-types, post-meta, publish
Display Custom taxonomy, Child terms and posts in a template Under Specific Parent terms
display Flexible Fields from options

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress