There are something wrong in your code, Here I edited what you tried,
function rohs_update_title($post_ID){
$post_type = get_post_type($post_ID);
// If this isn't a 'rohs_menu' post, don't update it.
if ( "rohs_menu" != $post_type ) return;
$postAuthorId = get_post_field( 'post_author', $post_ID ); // get the post author ID
$userToGetData="user_".$postAuthorId;
$restaurantName = get_field( 'nom_restaurant', $userToGetData );
$date = get_field('date');
remove_action( 'save_post', 'rohs_update_title' );
$menuName="Menu du ".$date.' chez '.$restaurantName;
wp_update_post( array( 'ID' => $post_ID, 'post_title' => $menuName ) );
add_action( 'save_post', 'rohs_update_title' );
}
add_action( 'save_post', 'rohs_update_title', 10, 1 );
Now try this and let me know
Related Posts:
- Automatically fill custom field value on post publish/update
- wp_update_post based function works on existing posts, but not new posts
- Custom Taxonomy terms aren’t getting referenced or saved in Quick Edit or Bulk Edit, only on Single product page?
- Troubles with acf/save_post and WP_Query
- How to export custom post type with ACF to individual file with automation?
- How to keep a record of changes to a custom field?
- Custom Post Type and Structure Question
- Save_post acf data not updating category of post type
- Adding specific custom fields (images) to post excerpt
- In the admin, how can you list thumbnails instead of titles for a custom post type?
- Link two different post using there post_id in post meta
- Advanced Custom Fields – Add Field to Specific Page [closed]
- Function that get ACF fields value before saving
- Collection of fields in a single post
- Custom post type adding additional markup
- How to automatically update ACF field value every year?
- Generate Post Title From ACF Fields on Custom Post Type
- How to create a custom search for custom post type?
- what is the correct way to compare dates in a WP query_posts meta_query
- How do you use a CPT as the default home page?
- Can a custom post type have a Parent Page?
- don’t publish custom post type post if a meta data field isn’t valid
- Media library – Limit images to custom post type
- Custom Taxonomy with Custom Post Type Finds No Posts
- ACF Relationships in Custom Post Type Permalink
- Is there an easy way to AJAX-ify saving of post?
- Query by 2 values of a repeater ACF field
- Restrict categories to a custom post type
- Get Custom Field Values by Another Custom Field in WordPress
- Programmatically adding posts
- Keep main articles and author blogs seprerate, News / Magazine like site
- Custom Post Type, Saving Multiple Checkboxes
- How to create an advanced filter search?
- Get rewrite slug of custom post type in template
- Custom Post Types not showing, custom WP_Query
- Create 3 Level Relations with ACF and WordPress
- How to: Display ACF [fields] on Custom Post Types Utilising WordPress ‘Hooks’? [closed]
- Retrieve value of a category’s custom field
- How to integrate video slide using custom post types?
- Cluster CPT posts to users based on ACF value from their profile on dashboard
- ACF Values Don’t Show After Import Unless I Edit/Update Post
- Time based access control of custom post types – what is good approach?
- Stuck in Order by more then one
- Show titles, date of all posts on single category page
- Query Custom Post Type Taxonomy term with multiple parameters
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- A form that can save/edit after first input
- How to group posts and get a mixed posts and groups view?
- Integrate Custom Post Type Events into Calendar
- don’t publish custom post type post if a meta data field isn’t valid
- WebP Fallback for Inline Background Image in Style Attribute
- Detect inside a custom query the kind of post type to assign custom classes
- custom post data – how to
- Recoverable Fatal Error – Object of class WP_Post could not be converted to string
- Add an Outside Wrapper to my Header and Make it Full Width
- What do the numbers mean at the end of add_action(‘save_post’)…?
- How can I add a shortcode to query Custom Post Type with ACF in WordPress?
- ACF for custom post type archive pages: which hook to use?
- How to Create a Separate Page for Blog Posts in WordPress
- Advanced custom fields Post Object image field not displaying in custom post type single.php
- Sum and count of custom field values
- Add custom columns in custom post type browse page
- How to hide a custom field from admin?
- Get terms for a specfic post from multiple taxonomies in custom post type
- cannot achieve this structure (custom posts VS categories VS ??)
- Is it possible to have hierarchical taxonomy and hierarchical custom post types in one permalink?
- SQL query – get ids – Advanced Custom Fields / WPeC
- Custom Post Type Meta Box Text Input Field Won’t Save When Blank
- how to use custom post types collectively integrated with each other
- Why doesnt my tag page populate with this custom post type?
- Home page is getting current-menu-item even if it’s not home
- How to set a ‘page’ as parent of a custom post type?
- custom post type and user post count shortcode
- Query posts by current ACF meta key value on single page as related posts
- Permalink URL connection between two custom types
- Show specific posts with WP_Query using ACF Post object
- CPT: multiple loops with different terms
- Autofill advanced custom field with user data
- Advanced search form with multiple custom fields
- Stored meta from attachment, video length?
- Custom post type option page template
- Help with Travel Guide Setup
- Metabox is not saving
- Custom Post save causes 500 error
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- Add category slug as class attribute in a link array
- Delete attachment with post
- Get link for feed of specific post type AND taxonomy
- If you’re calling a dynamic css inline style does that div have to be in the loop?
- Copying custom field value in to title
- Custom post type – columns order
- custom post-type query just returns two posts
- ACF Relationship: Group posts by parent category term, then child [closed]
- ACF Field to set Publish Date – Post Duplication upon Update
- Getting ACF relationship field information
- Why custom search engine only searches in post titles of custom posts?
- Post object GUID adding http:/
- Subpage for Custom Post Type
- Custom fields disappearing when a custom post type is assigned
- displaying ACF Repeater Fields in Backend sorted by a subfield