A bare-bones version would look something like:
function deny_post_date_change_wpse_131049( $data, $postarr ) {
$user = wp_get_current_user();
// var_dump($user); die; // debugging
if (in_array($user->ID,array(14,19))) {
unset( $data['post_date'] );
unset( $data['post_date_gmt'] );
}
return $data;
}
add_filter( 'wp_insert_post_data', 'deny_post_date_change_wpse_131049', 0, 2 );
I expect that in practice you probably want more complicated logic but that should get you started.
Related Posts:
- wp_update_post() example… how to update the_content in a textarea?
- Why wp_update_post() does not update GUID?
- What are the limitations of wp_update_post()?
- I need to bulk update all wordpress posts on a scheduled time
- wp_update_post does not update post_name
- What’s the proper way to use a custom table? [closed]
- Adding action to save_post, post needs to be saved twice for function to work
- “Internal Server Error” with wp_update_post
- wp_update_post using post_name
- how to get last revision id created after wp_update_post
- why wp_update_post cant update when value is empty?
- update a post with wp_update_post
- Updating posts not working
- Update a post’s info when clicking on a javascript button
- What ‘function’ will ‘update’ a post?
- Clear cache on post of one type when something happens to post of other type
- wp_update_post meta causing 500 error
- Updating post_parent by id (many times)
- wp_update_post making my post sticky
- How to keep a record of changes to a custom field?
- Is it possible to “Update” pages via SQL?
- Update post meta is slow while saving post
- Update post (published) date when changing category
- recursively update content
- wp_update_post ignores if/else
- $wpdb->update query incrementing value on it’s own!
- save_post affect creation and deletion
- Update button (sometimes) greyed-out
- Set a post to draft once depending on a post meta value (passed certain date)?
- wp_update_post behaves differently for different user role
- Fatal error: Call to undefined function wp_cache_get after update attempt
- Version Control: Entire site or just pieces?
- Getting a stack trace when an error occurs?
- Getting Post Comments for post ID using WP_Query() and a Custom Loop?
- Cleaning up WordPress to improve performance?
- Setting up custom post type archives in WP3.1? Any luck?
- Multiple WordPress sites with docker
- store simple data in get_option()
- how to redirect to a custom password retrieval page
- Is there a plugin to make attaching images easier?
- Edit Custom Database Tables in WordPress
- TV Show database – Best way for structuring it?
- What is the difference between feeds served by my WordPress install vs feeds served by FeedBurner?
- Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?
- How can I stop wp_update_post messing up HTML example code?
- Query posts by custom post type and custom taxonomy
- page_template toggle between 2 templates + 2 permalinks for same post
- Show One Category on Post
- Replacing the default content created while the site creation
- How do I perform a “get” call to an external API, and then display the JSON results on a page in my WordPress site?
- How to build a child theme from a react-based parent theme?
- removing custom tax & CPT slug, adding taxonomy term in front of custom type
- Woocommerce Product page edit
- Blogroll – Different layout for first post
- How to delete old posts’ edits to save space?
- Convert an theme options page to use in customize.php also?
- Setting up Different Layouts for Each Product Category and Subcategory [closed]
- Prevent access to custom login page for logged in users
- Adding all sub-pages to the menu manager
- How to import my YouTube channel into WordPress?
- Placing post data (title, date, and excerpt) nested in static content
- Make custom user table column filterable
- How I display post of the post type group by year of post?
- How to update preview when custom setting changed in my custom widget
- How to include a post type in the admin/backend?
- Side by side blogging?
- Adding custom fields to bbpress reply form
- Getting custom posts by post id from cutomizer text input
- Extra theme – header customization help [closed]
- Disable widgets in customizer for sidebar
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- Plugin for users to create their own ads like Google Adsence
- How to solve this problem with my subdomain?
- Change the style of h1, h2, only in post entry
- how to add custom logo to my template
- How to insert data into meta box from another plugin?
- YOAST SEO won’t work on custom post type archive [closed]
- Templates without a loop, best practice?
- Get specific ACF key and value from all posts – no access to DB
- Display posts by combining multiple meta key
- Custom theme – how to link the image without posting it
- The work of WordPress Function update_post
- How can I replace content on site generated from plugin without changing plugin
- optimal taxonomy or custom post types
- Easily add custom HTML outside the main container?
- How to use WP conditional tag in a functions.php with OCEANWP Theme?
- Make Widget appear on Dashboard
- Woocommerce dependent attributes
- WordPress Install – “end of script output before headers” when running simple php script
- Conditional required fields for WordPress Contact Form 7
- How to replace part of shortlink with nothing
- Setting up staging area
- Multiple item layout with one query
- Multiple WordPress Pages
- How to add custom column to Custom post page list?
- How wordpress plugin hooks works? [duplicate]
- Do i need to use PHP in customizer api?
- Add variable : 1 Week ago
- When is it OK to create a custom table for a plugin? [duplicate]
- Using ACF to allow user to add and edit multiple saved forms