Home › Forums › Bug Reports › Name Field is lots of data
I just updated to WP 4.0 and ACF Pro 5.0.7. All of my name fields are strings of data such as this:
a:8:{s:4:”type”;s:8:”repeater”;s:12:”instructions”;s:0:””;s:8:”required”;i:0;s:17:”conditional_logic”;i:0;s:3:”min”;s:0:””;s:3:”max”;s:0:””;s:6:”layout”;s:5:”table”;s:12:”button_label”;s:13:”Add Selection”;}
Is this something with the 4.0 update or is my database really messed up?
Any help is appreciated. Thanks.
I guess the latest version, 5.0.7, does say it’s tested up to 3.9.2 and not 4.0. Guess I’ll just have to wait. Well that’s there incase you’re unaware of it.
I just exported the custom fields of the working copy and put it into my functions.php folder. It’d be nice to be able to add more fields though.
It’s working on my clean WordPress 4.0 with a fresh database and the latest version of ACF. So I updated it on the site that I’m working on but it’s still doing the data-string thing.
I restored the website to the previous version of WordPress to just update the ACF plugin and only update the database for ACF. Still getting the data-string in the name field. I’m kind of at a loss. I’ve disabled all the other plugins to see if that was effecting it, but it’s not.
I did go from embedding ACF in my theme to using the plugins panel, but I wouldn’t think that’d have anything to do with it. This isn’t the first time I’ve switched it.
Any help would be greatly appreciated.
Thanks
I switched the theme to test out the plugin. Default theme worked, so that told me something in my theme was altering the code. Through a process of elimination in my functions.php file, I found that this function was causing it to alter the name field:
add_filter('get_the_excerpt', 'end_with_sentence');
function end_with_sentence($excerpt) {
$allowed_end = array('.', '!', '?', '...');
$exc = explode( ' ', $excerpt );
$found = false;
$last = '';
while ( ! $found && ! empty($exc) ) {
$last = array_pop($exc);
$end = strrev( $last );
$found = in_array( $end{0}, $allowed_end );
}
return (! empty($exc)) ? $excerpt.'</p><a class="cta-link" href="'. get_permalink($post->ID) . '" title="'. __( 'Read', 'wpBASEtheme' ) . get_the_title($post->ID).'">'. __( 'View Full Post <span>e</span>', 'wpBASEtheme' ) .'</a>' : rtrim(implode(' ', $exc) . ' ' .$last);
}
add_filter('wp_insert_post_data', 'end_with_sentence_on_save', 20, 2);
function end_with_sentence_on_save($data, $postarr) {
if ( ! empty( $data['post_content'] ) && $data['post_status'] != 'inherit' && $data['post_status'] != 'trash' ) {
$text = strip_shortcodes( $data['post_content'] );
$text = apply_filters('the_content', $text );
$text = str_replace(']]>', ']]>', $text );
$excerpt_length = apply_filters('excerpt_length', 55);
$data['post_excerpt'] = wp_trim_words($text, $excerpt_length, '');
} else {
return $data;
}
$allowed_end = array('.', '!', '?', '...');
$exc = explode(' ', $data['post_excerpt']);
$found = false;
$last = '';
while ( ! $found && ! empty($exc) ) {
$last = array_pop($exc);
$end = strrev( $last );
$found = in_array( $end{0}, $allowed_end );
}
if (! empty($exc)) $data['post_excerpt'] = rtrim(implode(' ', $exc) . ' ' .$last);
return $data;
}
So there’s no need to worry about this issue any longer.
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.