You can remove post type support for the editor on a conditional basis. The following should work:
add_action( 'add_meta_boxes', 'wpse45113_remove_editor' );
function wpse45113_remove_editor() {
// change the capability and post type to whatever is appropriate
if ( ! current_user_can( 'install_plugins' ) )
remove_post_type_support( 'post', 'editor' );
}
I’m using add_meta_boxes
because it fires not too long before the editor is initialized, but there are a number of hooks that would also work. You can similarly only add the meta box with the custom fields for those users within the same if block.
Related Posts:
- Tabindex on text input immediately after WordPress title input
- WP doesn’t show Array Custom Fields?
- Add new “Insert Into Post” button with another function
- Add meta data to the menu
- can you set a default value to a custom field
- Guest Author – How can I use custom fields to create guest author link?
- post meta data clearing on autosave
- How to reload the role specific registration form on validation errors?
- Add input field to ‘Pages > Edit Page’ through functions.php
- Auto-add paragraphs to custom field?
- Add description text under input field for new profile fields
- How to add a predefined custom field without using a plugin?
- Populate Custom Field Dropdown on Theme Install?
- Saving custom profile fields
- How to add content at the end of posts?
- Register rest field for specific user
- Add conditional custom option to ‘Display name publicly as’ dropdown
- How to show a gloabl message on a user profile page (in back end)?
- how to put a custom field value in variable
- Auto Populate Custom Field with Complex Value That Increase by One?
- Custom Metabox Not Saving
- Getting the ID of any image for use in functions.php
- Auto-remove custom field with no value on publish
- Display custom field values from posts on frontpage
- Custom Fields box in the post editor: Replace textareas with input elements
- How to allow users to post only in certain category and hide elements from edit page?
- Add additional ‘description’ field for defined roles / role metadata?
- Custom Field to a Role?
- Custom fields attached to a page template only show on edit screen when page is saved
- Display Custom Field for a Specific Role, but not for Admin
- Specific coditional usage [closed]
- Hide custom fields when empty
- HM CMB: Role Select
- Custom metabox not working
- Stripping and/or altering the content of a custom field (video URL)
- Odd functions.php issue in WordPress
- Making custom meta box required (with error message if not filled in) on Gutenberg
- HTML for adding a meta box (basic text field) to page editor?
- Hide custom fields by user’s role
- Meta boxes not displayed, data isn’t being saved
- Calling Custom Field within Function wrapped with Divs.
- Get fields from metabox array
- Including inline Custom Fields info with add_filter in functions.php
- file upload user profile
- How to automatically create a custom field when a post is published?
- Custom Admin Menu Report for Specific User ID
- Custom post type needs to capability to create and edit by some specific user role
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- WordPress custom fields feature is missing in my installation
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- How to display a product features dynamically with icons?
- Print Posts if Custom Field Value Date equal or greater than Today Date
- Branch made by several custom values
- Is it preferable to use custom code to create metaboxes instead of plugins (such as ACF) and if so why? [closed]
- Function that replaces the image in the absence of the post meta
- Access ACF fields within custom preview function?
- WordPress Settings API Repeatable fields
- Sanitize user input fields before wp_insert_post
- Looping inside block return
- check for duplicate user meta data before updating
- how to make a custom field readonly or disabled by user role?
- Use Advanced Custom Fields – replace line of code that hardcodes the tag into the template
- frontend submit post jQuery clone row won’t save
- Values entered in a meta box aren’t saved
- Woocommerce Retrieving custom field value from orders
- WordPress colorpicker save both hex and RGB
- Custom Field Repeating When Using foreach
- How to update a custom field in all posts with the value of another custom field in the same post?
- Programmatically add Yoast meta description after post save
- Is it possible to populate a custom field with content from a page
- How to copy data from a custom field to the post_content?
- load CSS only for administrators on backend
- Shortcode for Listing Users from Meta Value?
- Adding additional roles on registration
- How add multiple wp_editor_box to new post
- Cannot save underscore custom fields in one wordpress installation using xmlrpc and underscores
- Is there a way to set default custom fields when creating a new post?
- Update post meta custom field using block editor
- How can php be used to return data from custom fields in a post?
- Increment user meta data by 1 each time a page is visited
- WP All Import / Update stock quantity from multiple XML files
- Scripts and tags will not save or output from my custom meta box
- WordPress creates new lines in postmeta table on post update
- How to add custom filed value after in wp post title
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- WP Cli – post add meta in xargs after wp post generate – add multiple fields
- change order of images attached to post
- Anyone know how to use ACF and show custom fields for logged in users only on a post? [closed]
- Sortable Custom Columns not sorting correct
- Is there a size limit to the value you can save in a custom field?
- Advanced Custom Fields and Post Meta Fields Relation
- How can I check if a custom field was updated?
- How to redirect to home page according to a specific page custom fields value and user name
- If one meta key value is empty, try to get another meta key, and if both meta keys are empty show something else?
- Sort posts by clicks on download button
- Can’t get video meta from wp_read_video_metadata()
- Display meta box dropdown (from custom post type) in the page post type
- Buik update custom field values from external API
- How to use pre_get_posts to alter posts_per_page of category pages, where ‘posts_per_page’ will be dynamic
- Pass PHP through redirect and custom fields