The way I would approach this is:
- Create a custom field with an underscore in front of it – Example: _rating this way it doesn’t show up in the normal custom field interface
- Create a meta box that manages this custom field
- Wrap your add_meta_box function with if(current_user_can(‘administrator’))
This will only create the meta box if a user is an administrator. It’s not a fireproof method unless you disable the custom field interface.
If this is a plugin you can use remove_meta_box if the user is not an administrator before the post edit page renders.
Related Posts:
- ORDER BY custom field value
- Best way to programmatically remove a category/term from a post
- display specific custom fields
- Add new “Insert Into Post” button with another function
- Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post
- How to add new custom page or post blocks?
- Transients vs CRON +Custom Fields: Caching Data Per Post
- How to update serialized data in the user meta data
- Unable to save datetime custom meta field using update_post_meta() function
- Create a select drop down of available menus
- Best way to allow manageable social media URLS?
- Slow meta query with multi meta keys
- Custom Field Multiple Clauses
- Adding a custom field or metabox to the post-thumbnail widget?
- Using WP Query to search by multiple meta fields
- Get aggregate list of all custom fields for entire blog
- Send Multiple Custom Field Values Through the URL
- Sort by posts that have a featured image?
- WP_Query display next custom post from today’s date
- Can ordering post list by meta_value cause performance issue?
- $wp_query meta_key naming issue [closed]
- Meta_query and numeric comparison [closed]
- Title and post URL based on custom fields?
- Woocommerce with metabox plugin
- woocommerce product custom field
- using multiple meta_key and meta_value in query_posts
- Multiple relationships in a query
- How Meta Data is different from Custom Fields of POST/PAGE in WordPress
- two custom fields question
- How to save multiple options from a dropdown in user profile
- How to display multiple images in custom field
- How to show a gloabl message on a user profile page (in back end)?
- global function to apply filter to custom field
- How to add a new meta key and assign timestamp to posts
- Display the contents of a custom field of a page on their child
- Print custom field in Query Loop block
- Read / Watch / Listen times – meta
- Login WP – Connect single field to an external api
- Order RSS content by an advanced custom field value
- Advanced search by two criteria – sort by location and date (ascending or descending)
- adding extra wordpress user info from registration form
- Custom Meta Box (SELECT) Not Saving
- Collect user custom field in product page woocommerce
- Turn raw url into clickable links
- get posts where a custom field contains a text
- Displaying a custom field
- meta fields for the whole wordpress site
- Advanced Custom Fields functionality without plugin
- Get post ids sorted by meta_key
- Advanced Custom Fields Plugin – Unable to get URL from post_object
- Plot location on Google map using full address specified in custom field
- Unable to get specific value from post meta
- 3.8 Media Upload and Custom Meta Box
- Displaying Custom Field Array
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- Let’s Create Custom Field Template Documentation
- WordPress Settings API Repeatable fields
- WordPress creates new lines in postmeta table on post update
- How to add custom filed value after in wp post title
- User customising position of WordPress Featured Image
- Accessing Custom Fields on Pages
- How to Pass values to Custom Field through PHP in WordPress Posts?
- Custom field php
- Display a different image for each page with editor
- how to add product subscription field in woocommerce plugin
- How can I change the publish date based on a custom field?
- WP_query multiple custom fields not working
- Best way to sort estates and query them (for rent? yes/no. contains office space? yes/no)?
- Getting and calculating averge value of custom fields of the same tag
- Custom Field Date Problem
- Approach to creating a site with this structure
- how to create meta key name in wp_usermeta table in database
- Display the output from Custom User Fields from a WordPress user profile on a WordPress Custom Page
- how to turn a link field into a button or link text
- Use value from ACF to populate other fields
- Dynamically populate query source in Elementor post widget
- Adding Facebook’s image and meta description retrieval capabilities to a WordPress post
- Why does my numeric meta query work only on one meta key and not the other?
- Show image depending on the number in the custom fields
- Show echo ready in single.php
- Save, update, get and sanitize post meta as HTML not plain
- author global display format
- Should I store arrays in custom fields or create custom tables?
- Problem saving meta data
- Term specific featured post on taxonomy archive pages
- WP_query returns error when used for custom widget
- Saving metadata of related post on save_post
- Custom field value link title
- How to Order Posts by Custom Fields?
- added a meta box to post however when saving menu while debug on throws a warning
- How can i get the actor birthday by date?
- Post rating using Custom Field
- Inserting custom fields into new-post.php without using the Custom Fields Template plugin?
- How can I attach files without using a plugin?
- Advanced Custom Fields for Header that are Editable from a Page [closed]
- Change Fields of Comments and make them searchable?
- Shortcode not picking up custom field
- Order by a meta field in query loop
- Multiple triggers when publishing, saving or updating a post in WordPress
- If possible a field ID transfom in a Custom Field?