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:
- How to programmatically create a connection with [Plugin: Posts 2 Posts] on cpt publish?
- Can’t publish custom post type – “You are not allowed to edit this post.”
- Get only used meta_values
- Query all posts where a meta key does not exist
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- what is the correct way to compare dates in a WP query_posts meta_query
- Advanced search form with filters for custom taxonomies and custom fields
- Meta query with boolean true/false value
- Get post with multiple meta keys and value
- Correctly delete posts with meta and attachments [duplicate]
- Storing revisions of metadata for custom post type
- Custom field values deleted when trashing custom post type
- How to get all custom fields of any post type
- Update CPT meta data using REST API
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- Echo all meta keys of a custom-post TYPE
- Custom Post type – how to get checkbox to update meta field to null
- How can I filter posts by post_parent in the admin?
- How do I Paginate Search Results for Custom Post Types?
- Ordering posts having multiple post-meta date fields
- Custom Post Type with Input fields to seperate table on database.
- How do I remove all the metaboxes for a custom post type?
- Customize users’ capabilities to change a custom post’s post status
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Gutenberg how to make attribute to save to meta
- Post metadata deletes itself
- How to create a mini directory in WordPress?
- How Can I save multiple records in same meta key?
- Get all posts from custom post type and insert in select input as metabox
- Detect meta value changes when post is updated (post_updated)
- Search everything (posts, pages, tags, cpt, meta)
- Permalinks using event date (year & month) instead of publication date
- Custom Post Type: Set post_title equal to a custom post type field
- I can’t set meta_key in my custom post type query
- Grossly inefficient wordpress loops!
- Compare 3 custom fields and sort by oldest
- How Do I Use WP_Query to Run This Database Query as Search Result?
- WordPress Admin Panel search posts with custom post meta values along with title
- Creating a custom post type upon registration
- How to Update post status using meta data in Custom post TYpe
- Rest Api v2 orderby meta_key in custom post type
- bulk Update post_meta with default values
- Reason action hook won’t work with update_post_meta from frontend form? Alternative?
- Can’t sort order of wp_query with 2 meta keys
- Showing Meta Data for Custom Post Types?
- How to get source of custom meta image?
- Having trouble with custom post type / meta box
- Query for posts from any post type but only add instock products
- How can I include meta box content when searching?
- wp_publish_post breaks permalinks
- update a post meta from a single table cell TablePress
- update custom post type meta from a shortcode
- Custom Meta Boxes – Nonce Issue – Move to trash issue
- Displaying Meta Box Image
- Custom post type category not displaying in custom post type
- How to make custom post meta wp_editor translatable?
- Automatically adding meta data to posts or multiple query help
- How to keep a check box in custom meta box for custom post type checked by default for add new post?
- How to add multiple featured image in meta box in post editor?
- Show metabox in custom-post-template depending on taxonomy term?
- ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
- update_post_meta() whenever custom post type is updated
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Posts created in a Custom Post Type are lost if published without a title
- Trigger “unsaved changes” dialog for custom post meta changes
- Using date stored as custom field to filter posts displayed in admin
- Conditionally Query Custom Post Types by Post Meta for Blog Home Page?
- Displaying custom posts only if custom meta box’s date is not expired
- Displaying Metabox value (custom post type taxonomy)
- How do I sort a custom post type admin column using two meta keys?
- Add Post Url to Manage Edit Screen
- Registration and Custom Post Types – How to synchronize information?
- How to best delete orphan wp_postmeta
- How can I display my custom metaboxes on a custom post template?
- Display all custom post type posts and order them by an optional meta_key
- Meta Box Only in CPT Edit Page, Not in Add New
- get_post_meta is returning image id
- Custom Post Type, Saving Multiple Checkboxes
- get_template_part() – post-meta not working?
- How can I get_post_meta() in the most efficient way?
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- Count posts with specific term_meta
- Custom search for custom post meta with pre_get_posts interferes with WP search
- Create a random unique 6 digit number as custom field for custom post type
- Export entries and multiple custom field meta to .csv?
- how to interconnect custom post types?
- WordPress Orderby Numeric Value Not Working
- Custom Post Status Transition Issues With Get Post Meta
- Replace title column in post list with post meta value
- Metadata for a taxonomy – is there any WordPress way of doing this?
- My theme saves their custom post type’s metadata as a serialized array, how to access the keys?
- List all images from a single post meta value
- Does WordPress limit the length of slug names for Post Meta or Terms?
- orderby in custom WP Query does not work
- Populate Custom Fields in a Custom Post Type?
- Insert Multiple Post with Same Publish Button
- Update CPT post meta with update_post_meta and cron job
- Custom meta box data array: foreach not working correctly?
- Undefined Variable – Custom Post Type Meta
- Ordering posts in Search & taxonomy by post_meta