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
- ACF – Updating all posts of CPT when a custom field from options page is updated
- Permalink structure by Post Meta value
- How to integrate video slide using custom post types?
- How can I set taxonomy programmatically
- A question on creating filters for custom posts using taxonomy
- Conditional Query of Custom Post Type and custom taxonomy
- will post_id ever change? Can I safely use post_id for custom queries?
- List custom taxonomy specific to one custom post type
- Define new user capability for custom post types?
- How to allow visitors to enter custom post type?
- Is it possible to create relational metabox values in a custom post?
- Custom Post Type Query for Sidebar Doesn’t Work on Front Page
- Meta query for custom post type ignored in main query
- How to add a post slug to a url?
- Add custom ID to CPT posts only create not update
- WP_Query to select custom post type with Advanced Custom Fields (ACF) date
- 2 Templates 1 custom post type according url
- How do I move/order posts with a tag to the end?
- changing meta value and meta key of price field
- Bulk Update Custom Fields for Custom Post Types
- ACF Field on CPT Slug
- WordPress sort search results by custom order
- WP_Query order by custom field, then randomly order some of results
- Cluster CPT posts to users based on ACF value from their profile on dashboard
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- ACF Values Don’t Show After Import Unless I Edit/Update Post
- Hide parent categories when clicked, and show it’s childs
- Custom Path/Folder behind a custom post type
- Time based access control of custom post types – what is good approach?
- Query custom post type with ACF Date
- custom post type WYSIWG removes paragraphs when displayed
- Stuck in Order by more then one
- Custom Post Type + ACF and performance [closed]
- Show titles, date of all posts on single category page
- Meta Query Not Returning Output Despite Having Matching Values
- delete_published_posts does not work
- How to start a new post with custom Taxonomies already set?
- ACF From & To Date Validations
- WooCommerce sort products by the actual product width(not the shipping width)
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- How to render a custom post type template with custom fields using shortcode
- Create a custom php page and load it at a specific slug
- Structure of data : CPT + terms
- Exclude objects from WordPress API based from ACF field using rest_prepare_{$post_type}
- How to handle paged param in post and custom-post-type?
- CPT archive admin menu label
- Rewrite Rule for showing Parent/Child Relationship between Two Hierarchical Custom Post Types
- Default text in a specific post type, but not visible?
- Update postmeta Parent when post_status child change
- Order Custom Post Type by Custom Field Value
- WP_Query custom post type query not showing the exact post type
- Retrieve custom field from Contact Form 7 [closed]
- Shortcode to display Staff post type based on Location post type and Specialty post type
- Query Custom Post Type Taxonomy term with multiple parameters
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- How to query WordPress posts bycustom field with a max characters’ length
- How to remove post listing page for a custom post type
- How to include term custom meta into the custom taxonomy term permalink structure
- How to Get WordPress custom post data in WooCommerce product meta panel? [closed]
- A form that can save/edit after first input
- The loop seems stuck to a single (now deleted) post
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- Adding the_content() in custom template email
- Cannot save CPT meta box
- non-hierarchical post type with hierarchical url structure
- Send notification to the admin when new custom post is submitted
- How do i search authors from search form using author’s name
- CPT Validation to not show “Post updated.”
- Allow users to create posts without logging in?
- How to update post meta on uploaded image from a custom form?
- How to add attributes to taxonomies that may be different from post to post?
- Pages are not saving due to custom post type
- How to group posts and get a mixed posts and groups view?
- Post author for revision not being set on update/insert
- Custom Post Types vs. Advanced Custom Fields (with Repeater Field add-on)
- Multiple Frontend Filters Using Advanced Custom Fields
- Migrating a taxonomy’s tags to the native category
- Integrate Custom Post Type Events into Calendar
- Specific routing for CPT
- Order post by date with ACF
- Displaying custom field according to date
- How to produce a sub-page-system in WordPress
- save_post custom post type ? $_POST not working?