Yes, it can be done (it’s almost always true ;))… The question is how to do this? 😉
And here is the solution… You’ll have to use acf/load_field
filter:
function set_acf_field_default_value( $field ) {
switch ( $field['name'] ) {
case 'name_provider':
$field['value'] = 'PUT YOUR VALUE HERE';
break;
}
return $field;
}
add_filter('acf/load_field', 'set_acf_field_default_value' );
PS. Of course you can use if
statement in there, but you rarely want to prefill only one field, so it’s easier to do this with switch
.
Related Posts:
- Want to Add Custom Fields for Uploading video to WordPress Users from front end
- Filtering a WP_Query meta_query by numeric values isn’t working
- Automatically fill custom field value on post publish/update
- Filter a custom field based on selection of another custom field (ACF) [closed]
- ACF Relationships in Custom Post Type Permalink
- How to sort a table of custom posts by column containing custom field
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- Use Custom Post Type as Custom Field
- 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()
- Community and User Generated Content Website: Have been thinking about Drupal but leaning on WordPress heavily
- Get Custom Field Values by Another Custom Field in WordPress
- How to Display ACF Relationship Custom Field as Link to Specific Custom Post?
- Query Custom Post Types by date (custom field) range
- Link users to a custom post type
- Custom Post type and Custom Field WP_Query
- How to change post featured image using a custom field of category?
- how to delete all users and posts based on ‘user_meta’?
- Retrieve value of a category’s custom field
- How can I dynamically add a post to a custom post type which uses a custom field?
- WP_User_Query pulling ACF to loop
- Bulk Update Custom Fields for Custom Post Types
- 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
- Query custom post type with ACF Date
- Meta Query Not Returning Output Despite Having Matching Values
- ACF From & To Date Validations
- 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
- Order Custom Post Type by Custom Field Value
- Users create/join groups
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Query posts based on the meta key values of logged-in users?
- Multiple Frontend Filters Using Advanced Custom Fields
- Integrate Custom Post Type Events into Calendar
- Displaying custom field according to date
- WebP Fallback for Inline Background Image in Style Attribute
- Query based on custom fields start and end date
- How to get a custom type post data when it has a connection with another custom type post?
- List of users that clicked a ‘Join’ button at single post
- How to inherit field value from parent post into in child / sub post
- ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?
- Custome fields not displayed
- posttype and custom fields on multisite
- How do I get_the_postID() for a custom post that uses ACF repeater field?
- How do I replace the post title with a custom field?
- Sum and count of custom field values
- Group by custom field value (start and end times)
- Custom post types, disable fields
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- Excerpt length: get first paragraph
- Display custom post front end filter by ACF equals current user
- Show/hide posts and categories based on user meta
- 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?
- ACF – Retrieve custom taxonomy from a relationship field
- Create if else for post types in WP_Query ‘post__in’ values
- Display Custom Field or Custom Taxonomy in front page /post/product
- How to access repeater field of a custom field?
- Filter posts by their related field’s custom field
- filter using custom fields
- Advanced search form with multiple custom fields
- How do I display specific custom posts, and how do I edit a post’s singular page?
- Fixed custom fields depending on posttype/category
- Automatically convert standard posts with custom fields to custom post types
- UPDATED: Save a custom_field value when automatically creating a post using wp_insert_post
- Can’t pick up a field created with Advanced Custom Fields
- Creating multiple profiles under one user to assign to particular posts
- Get month and day from a Date Picker custom field
- Setting a custom $query->query_vars[‘meta_key’] breaks the WordPress menu
- Display and Allow users to edit their own profiles
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- How to show animal lineage/pedigree in WordPress?
- ACF – Query relationship without ID
- Save multiple checkboxes with Types
- Retrieve a post with its ACF repeater fields in wordpress
- Is it possible to specify a time interval (from, to) in ACF with date picker, or other custom field?
- Display ACF object field data using Elementor Custom Query
- Post object GUID adding http:/
- Custom Sort Order for Custom Post Type Taxonomy
- Do_Shortcode not working for Embed
- add_meta_box: Datepicker like the one for postdate?
- Custom field losing p tags on display
- Custom fields in Permalinks?
- query posts and custom post type with meta key
- Adding Show Less/More link to Custom Post Meta
- How to assign permissions for a CPT to a user
- Custom post type name and assigning custom taxonomy
- Building a Portfolio and need some direction
- Save custom field types with this function…?
- Creating a custom page post type just like the original “pages” post type using CPT UI
- count & sum the value of custom field of the author post in dynamic posts
- Display a Custom Post Type with Advanced Custom Fields on Homepage
- Same custom post type with different ACF
- Ordering Post by Meta Key (Not Working)
- Custom Field to post_title
- custom fields not showing before get_header
- Display Custom Post if custom field is marked
- predefined custom field on registration page
- Select Menu for Custom post Type does not save
- Allow authors to create article image