{"action":"created","issue":{"url":"https://api.github.com/repos/htmlburger/carbon-fields/issues/154","repository_url":"https://api.github.com/repos/htmlburger/carbon-fields","labels_url":"https://api.github.com/repos/htmlburger/carbon-fields/issues/154/labels{/name}","comments_url":"https://api.github.com/repos/htmlburger/carbon-fields/issues/154/comments","events_url":"https://api.github.com/repos/htmlburger/carbon-fields/issues/154/events","html_url":"https://github.com/htmlburger/carbon-fields/issues/154","id":195172683,"number":154,"title":"If I remove the default WP editor, CF won't save at all","user":{"login":"edwardhew","id":365615,"avatar_url":"https://avatars.githubusercontent.com/u/365615?v=3","gravatar_id":"","url":"https://api.github.com/users/edwardhew","html_url":"https://github.com/edwardhew","followers_url":"https://api.github.com/users/edwardhew/followers","following_url":"https://api.github.com/users/edwardhew/following{/other_user}","gists_url":"https://api.github.com/users/edwardhew/gists{/gist_id}","starred_url":"https://api.github.com/users/edwardhew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edwardhew/subscriptions","organizations_url":"https://api.github.com/users/edwardhew/orgs","repos_url":"https://api.github.com/users/edwardhew/repos","events_url":"https://api.github.com/users/edwardhew/events{/privacy}","received_events_url":"https://api.github.com/users/edwardhew/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-13T06:27:43Z","updated_at":"2016-12-13T11:46:53Z","closed_at":null,"body":"If I do this in functions.php to remove the default WP editor\r\n```php\r\nremove_post_type_support('page', 'editor');\r\n```\r\n\r\nBelow this is how I remove the core WP editor, it works, the editor is removed based on what template path passed into `uses_template` shown below, the carbon fields show up correctly, but when I hit save, carbon fields will not save, no rows created in wp_postmeta at all.\r\n\r\nWhen I tried keeping the WP core editor, where carbon fields appear below the default WP editor, carbon fields will then save correctly.\r\n\r\nThis is how I did it with CMB2 on some pages, remove core editor, just rely on the postmeta, that saved correctly. Not sure if I'm missing something here or that's how it is.\r\n```php\r\n/**\r\n * Does current page being edited use a particular template?\r\n */\r\nfunction uses_template($template) {\r\n    if (get_post_meta((int)$_GET['post'], '_wp_page_template', true) == $template) {\r\n        return true;\r\n    }\r\n    return false;\r\n}\r\n\r\n/**\r\n * Remove core editor\r\n */\r\nfunction remove_editor() {\r\n    remove_post_type_support('page', 'editor');\r\n}\r\n\r\n// Homepage custom fields\r\nadd_action('carbon_register_fields', 'crb_register_homepage_fields');\r\nfunction crb_register_homepage_fields() {\r\n    $template_path = 'templates/page-home.php';\r\n    if ( uses_template($template_path) ) {\r\n        include_once(dirname(__FILE__) . '/custom-fields/field-home.php');\r\n        add_action('admin_head', 'remove_editor');\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/htmlburger/carbon-fields/issues/comments/266718413","html_url":"https://github.com/htmlburger/carbon-fields/issues/154#issuecomment-266718413","issue_url":"https://api.github.com/repos/htmlburger/carbon-fields/issues/154","id":266718413,"user":{"login":"edwardhew","id":365615,"avatar_url":"https://avatars.githubusercontent.com/u/365615?v=3","gravatar_id":"","url":"https://api.github.com/users/edwardhew","html_url":"https://github.com/edwardhew","followers_url":"https://api.github.com/users/edwardhew/followers","following_url":"https://api.github.com/users/edwardhew/following{/other_user}","gists_url":"https://api.github.com/users/edwardhew/gists{/gist_id}","starred_url":"https://api.github.com/users/edwardhew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edwardhew/subscriptions","organizations_url":"https://api.github.com/users/edwardhew/orgs","repos_url":"https://api.github.com/users/edwardhew/repos","events_url":"https://api.github.com/users/edwardhew/events{/privacy}","received_events_url":"https://api.github.com/users/edwardhew/received_events","type":"User","site_admin":false},"created_at":"2016-12-13T11:46:53Z","updated_at":"2016-12-13T11:46:53Z","body":"Thank you again, you solved my last question too :)\r\n\r\nYes, I am using `show_on_template`, but here I wanted to also hide the WP editor, at the same time bypass this particular call to CRB if user is not working with this template ... but I can see the problem with my logic now, I should really just bypass the whole block altogether if that is the case.\r\n\r\n1++\r\n"}}
{"actor":{"display_login":"edwardhew"}}