[英]ACF: repeater fields returning erratic API data and new fields won't accept new data on save
The site we are working on has broken in the last week and we have no idea what is going on. 我们正在处理的网站在上周已损坏,我们不知道发生了什么。 Here is a list of issues, and the steps we've taken to troubleshoot them:
以下是问题列表,以及为解决这些问题而采取的步骤:
Troubleshooting Steps 故障排除步骤
Thanks in advance for any guidance you're able to provide :) 在此先感谢您能够提供的任何指导:)
Turns out it was this piece of code in functions.php that we were using to re-write the slugs on save of the posts was the issue: 原来是问题所在的是functions.php中的这段代码,我们用来重写这些代码是问题所在:
function myplugin_update_slug( $data, $postarr ) {
if ( ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) {
$data['post_name'] = sanitize_title( $data['post_title'] );
}
return $data;
}
The sanitize_title() function was overwriting the key field and causing ACF to lose track of the fields. sanitize_title()函数覆盖了关键字段,并导致ACF失去了对该字段的跟踪。
We resolved this by activating a clean WP theme, then once we confirmed that it was some code in our child theme we just commented out code in our functions.php file until the offending function was found. 我们通过激活一个干净的WP主题解决了这一问题,然后,当我们确认它是子主题中的某些代码时,我们只是在我们的functions.php文件中注释掉了代码,直到发现有问题的函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.