Home › Forums › Backend Issues (wp-admin) › Data Saving Incorrectly on New Post
ACF Version: 5.7.12
WP Version: 5.0.3
I have a simple field group with,
1) text field for URL
2) select field for URL target
3) date picker for start date
4) date picker for end date
When I add a new post of this type and publish below is what I get!
1) contains the value of the end date text
2) is empty
3) is empty
4) is empty
But, if I now edit this post to again to put in proper values for each field and save, all the data is correct and in the proper field!
Below this message is my code for creating the custom post type.
Can you help me figure out why this is happening and how to correct it?
Thanks!
———————
// Register Custom Post Type
function rc2_notices_post_type() {
$labels = array(
‘name’ => _x( ‘Legal Notices’, ‘Post Type General Name’, ‘text_domain’ ),
‘singular_name’ => _x( ‘Legal Notice’, ‘Post Type Singular Name’, ‘text_domain’ ),
‘menu_name’ => __( ‘Legal Notices’, ‘text_domain’ ),
‘name_admin_bar’ => __( ‘Legal Notice’, ‘text_domain’ ),
‘archives’ => __( ‘Legal Notice Archives’, ‘text_domain’ ),
‘attributes’ => __( ‘Legal Notice Attributes’, ‘text_domain’ ),
‘parent_item_colon’ => __( ‘Parent Legal Notice:’, ‘text_domain’ ),
‘all_items’ => __( ‘All Legal Notices’, ‘text_domain’ ),
‘add_new_item’ => __( ‘Add New Legal Notice’, ‘text_domain’ ),
‘add_new’ => __( ‘Add New Legal Notice’, ‘text_domain’ ),
‘new_item’ => __( ‘New Item’, ‘text_domain’ ),
‘edit_item’ => __( ‘Edit Legal Notice’, ‘text_domain’ ),
‘update_item’ => __( ‘Update Legal Notice’, ‘text_domain’ ),
‘view_item’ => __( ‘View Legal Notice’, ‘text_domain’ ),
‘view_items’ => __( ‘View Legal Notices’, ‘text_domain’ ),
‘search_items’ => __( ‘Search Legal Notices’, ‘text_domain’ ),
‘not_found’ => __( ‘No Legal Notices found’, ‘text_domain’ ),
‘not_found_in_trash’ => __( ‘No Legal Notices found in Trash’, ‘text_domain’ ),
‘featured_image’ => __( ‘Featured Image’, ‘text_domain’ ),
‘set_featured_image’ => __( ‘Set featured image’, ‘text_domain’ ),
‘remove_featured_image’ => __( ‘Remove featured image’, ‘text_domain’ ),
‘use_featured_image’ => __( ‘Use as featured image’, ‘text_domain’ ),
‘insert_into_item’ => __( ‘Insert into item’, ‘text_domain’ ),
‘uploaded_to_this_item’ => __( ‘Uploaded to this item’, ‘text_domain’ ),
‘items_list’ => __( ‘Items list’, ‘text_domain’ ),
‘items_list_navigation’ => __( ‘Items list navigation’, ‘text_domain’ ),
‘filter_items_list’ => __( ‘Filter items list’, ‘text_domain’ ),
);
$args = array(
‘label’ => __( ‘Legal Notice’, ‘text_domain’ ),
‘description’ => __( ‘RecCentric Legal Notices’, ‘text_domain’ ),
‘labels’ => $labels,
‘supports’ => array( ‘title’ ),
‘hierarchical’ => false,
‘public’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘menu_position’ => 5,
‘show_in_admin_bar’ => true,
‘show_in_nav_menus’ => true,
‘can_export’ => true,
‘has_archive’ => true,
‘exclude_from_search’ => false,
‘publicly_queryable’ => true,
‘capability_type’ => ‘page’,
);
register_post_type( ‘legal_notices’, $args );
}
add_action( ‘init’, ‘rc2_notices_post_type’, 0 );
Hi @johnstaples
Thanks for the bug report. I’ve just tested out the “Add new” post page in WP and was not able to replicate any issues saving custom field data.
Can you please spin up a fresh install using the “Local by flywheel” app and test out ACF on a vanilla website?
Please let me know if you were able to replicate the issue.
Hi,
exactly the same issue here.
WP: 5.1.1
ACF: 5.7.12
I was able to find there is a conflict with the following plugin:
https://wordpress.org/plugins/social-networks-auto-poster-facebook-twitter-g/
SNAP: 4.3.4
Save as draft or (update post like described in the original post) is working fine. Only the original publish option is not working correctly.
thanks for this nice plugin and hope you will be able to solve this issue.
Good luck.
Just found right now a hack to apply to the SNAP plugin to solve this issue:
https://wordpress.org/support/topic/conflict-with-advanced-custom-fields-pro-3/
No idea if you can apply this fix or something similar to ACF.
Lolo Irie, THANK YOU, THANK YOU, THANK YOU! I have tried the hack and it does resolve the ACF issue. I’m not sure if it might also mess up SNAP functionality so I have asked that dev to confirm if it is OK to use.
I still hope that either the ACF dev and/or the SNAP dev can find a more permanent solution so no hacks are required. But you helped me immensely by pointing out this hack!
Hi John,
you’re welcome.
feel free to post here as well for SNAP developers:
https://wordpress.org/support/topic/lost-data-if-used-with-acf/
Cheers
Lolo
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We’re hard at work on ACF 6.1, and Beta 1 is now available 🚀
— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.