I wasn’t adding the ID into the new array.
if ( get_post_type( $post_id ) == 'equipment' ) {
$my_post = array();
$my_post['ID'] = $post_id;
$my_post['post_title'] = get_field( 'name', $post_id );
wp_update_post( $my_post );
}
Related Posts:
- Automatically fill custom field value on post publish/update
- save_post affect creation and deletion
- Filter by custom field in custom post type on admin page
- Filtering a WP_Query meta_query by numeric values isn’t working
- Populate a ACF Select Dropdown from Custom Post Type
- Filter a custom field based on selection of another custom field (ACF) [closed]
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- Retrieve a specific field from taxonomy term through advanced custom fields [closed]
- Count custom post types with a specific meta value
- wp_update_post on specific custom post type
- Change message given when deleting post from custom post type
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Display posts if a custom field value is equal to another custom field value
- ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
- Query Custom Post Types by date (custom field) range
- Remove duplicated values from a loop
- How Can I Set the Post Author of a Post I Just Created With PHP?
- How to retrieve category NAME instead of ID in a function with a taxonomy custom field?
- “add_post_type_support” with Custom Post Type & ACF
- ACF simple text field value not showing
- Post Object Filter by Custom Field, not title (ACF)
- Custom Post type and Custom Field WP_Query
- Display multiple custom post types and sort them chronological by one of their fields
- Multiple ACF Repeaters within a Custom Post Type
- How to change post featured image using a custom field of category?
- Custom fields vs. Custom post types for a Portfolio Website
- the_content() not outputting anything (Advanced Custom Fields)
- How to add a post slug to a url?
- Add custom ID to CPT posts only create not update
- ACF Field on CPT Slug
- WP_Query order by custom field, then randomly order some of results
- Custom Post Type + ACF and performance [closed]
- Meta Query Not Returning Output Despite Having Matching Values
- How to render a custom post type template with custom fields using shortcode
- How to query WordPress posts bycustom field with a max characters’ length
- The loop seems stuck to a single (now deleted) post
- Post author for revision not being set on update/insert
- Multiple Frontend Filters Using Advanced Custom Fields
- Displaying custom field according to date
- How to set the seo title tag on a page by page basis?
- Advanced custom field boolean value in custom post type
- Why would social icon badges disappear after adding a custom post type?
- Sort a custom post with ACF: Date Picker & Display Featured!
- ACF repeater field usage
- Postname on unique permalink structure appends “-2” for a custom post type. How can I get this to stop happening?
- Custome fields not displayed
- Create short URL with auto 301 redirect
- Batch Extract Date from post title and put into ACF custom field
- Why is wp api returning old acf values?
- get custom post type value in header.php [closed]
- How do I get_the_postID() for a custom post that uses ACF repeater field?
- Odd behaviour for the update button when displaying a WP_List_Table
- Group by custom field value (start and end times)
- Custom post types, disable fields
- ACF Relationship Posts how to show additional content
- Excerpt length: get first paragraph
- How to keep a record of changes to a custom field?
- Having a repeating custom field in admin custom post type, what I’d go better with, for DB’s sake? ACF repeater or query a different post type?
- How can i show ACF in post excerpts
- count & sum the value of custom field of the author post in dynamic posts
- Grouping custom wordpress post types by acf value
- Set Post Private if no linked Post Objects (ACF)
- Show in an entry a Custom Post Type associated to a post
- Orderby custom fields is not working
- Display a Custom Post Type with Advanced Custom Fields on Homepage
- Filter result of Custom Post Type using meta_query with ACF
- How to display posts with plugin (advanced custom fields) field groups?
- WordPress – display relationship between blog posts and custom posts
- Same custom post type with different ACF
- Custom sorting in post columns by ACF Pro Select Field
- Load info from customposttype into template page
- Subpages URLs for Custom Post Type
- ACF meta_key and meta_value break loop
- search results to show individual ACF fields from inside custom posts
- Videos Post Type with Custom Filters
- How to show link to product in custom fields?
- In the admin, how can you list thumbnails instead of titles for a custom post type?
- Use output of wp_dropdown_categories($args)
- Looping through image object using ACF and CPT UI [SOLVED]
- Values show up in custom home page but not in custom post pages
- Display related post content and custom field content
- WordPress page not showing up – replaced with last 10 posts?
- Best way to have one product in both rental and sale parent category
- How do I display specific custom posts, and how do I edit a post’s singular page?
- Automatically convert standard posts with custom fields to custom post types
- Showing custom post user wise with different color in wordpress
- Submit and edit font end custom post type
- How to load custom post type plugin after acf options page (or get settings from there another way)?
- Filter Content on all Post Types
- Advanced Custom Fields – Add Field to Specific Page [closed]
- $post breaking container loop
- Change custom post status to draft before today
- Collection of fields in a single post
- WooCommerce – Complete Order when an action occurs
- WordPress Loop trouble with ACF [closed]
- using a template for more then 1 page
- Retrieve a post with its ACF repeater fields in wordpress
- Display ACF object field data using Elementor Custom Query
- Two custom post type relations
- selecting custom post types and taxonomies for hub page listing blocks