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 set a default format for a custom post type?
- WordPress Custom Post Types with a page as a parent?
- Why won’t my metabox data save?
- Delete all the custom post types when deleting user
- Correct way to use a form to to filter custom posts by taxonomy terms?
- White screen error for a custom theme
- automatically create taxonomy with same name as post title
- How can I remove categories in menu in custom post type?
- Search results ordered by custom post types are not grouped
- saving custom post type data to different table in wordpress
- Query post types with multiple keys
- Get all posts WHERE custom_field is LIKE value
- Show ACF field from custom taxonomy and display on the single template
- Trigger “unsaved changes” dialog for custom post meta changes
- Show custom field from custom taxanomy term on custom post type
- How does the $post_type global variable work?
- How to create an array for a CPT post ID to use in an IF/WHILE statement
- Custom Post type with ACF in REST API, how do I get those values?
- Delete link on single-custom.php with redirection
- Getting rid of /my_custom_post_type/ in the single view URL
- Custom Post Type – List all attachments on Edit Screen
- Custom Page that comes with preloaded content for the user
- How to customize a permalink (URL) structure?
- will post_id ever change? Can I safely use post_id for custom queries?
- Is it possible to create relational metabox values in a custom post?
- Custom Post Type Query for Sidebar Doesn’t Work on Front Page
- WP_Query to select custom post type with Advanced Custom Fields (ACF) date
- Bulk Update Custom Fields for Custom Post Types
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- How to Get WordPress custom post data in WooCommerce product meta panel? [closed]
- Send notification to the admin when new custom post is submitted
- How to produce a sub-page-system in WordPress
- 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
- How do you make a custom post type items automatically delete items 3 months after publication?
- custom post data – how to
- Custom Post Type Metadata Not Saving
- 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
- Home page is getting current-menu-item even if it’s not home
- Create API’s for custom-post types & custom queries using REST or Graphql
- custom post type and user post count shortcode
- Query posts by current ACF meta key value on single page as related posts
- 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
- How to get a custom post type archive paged when using a custom field for post sorting?
- Help with Travel Guide Setup
- Metabox is not saving
- Custom Post save causes 500 error
- Custom post tag images not displaying with ACF
- How do I get a nested query to only display content that the main query outputed
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- Get post id of permalink for a specific custom post type?
- 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?
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- Copying custom field value in to title
- How to show animal lineage/pedigree in WordPress?
- Custom Post Type Loop breaking php
- Styling first post using Advanced Custom Fields
- Custom post type – columns order
- custom post-type query just returns two posts
- ACF Relationship: Group posts by parent category term, then child [closed]
- Is it possible to specify a time interval (from, to) in ACF with date picker, or other custom field?
- Delete old thumbnail when updating new
- Display ACF object field data using Elementor Custom Query