Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.75k stars 883 forks source link

Yoast SEO Causes Data loss in ACF PRO #16526

Open vervelover opened 3 years ago

vervelover commented 3 years ago

Hi,

I'm experiencing a severe bug with Yoast and ACF PRO. In a clean wordpress install, with just Yoast and ACF PRO installed, I have a flexible field with a gallery and a text field. If I add the gallery and the text a few times, update and reload the page a few times, data is corrupted (some fields disappear or change content). Uninstalling Yoast fixes the issue.

Here is a video:

https://drive.google.com/file/d/1L9J4JL6GFt8Tdn3G0XlISd5P840EP1PB/view?usp=sharing

Please Note: the video is not showing a clean WP install, I just did not want to re-record it, but I reproduced it on a clean install too (It takes a few more tries maybe), with only Yoast and ACF PRO and the default WP theme. All updated.

Here is a link to download the acf fleids as seen in the video:

https://drive.google.com/file/d/1Ke9Fgsy3xTrE9wZoDuNI924ur2gaC7V4/view?usp=sharing

thank you for looking into this.

WP Version: 5.6 Yoast SEO: 15.5 ACF-PRO: 5.9.3 PHP: 7.3

Djennez commented 3 years ago

Hi @vervelover . It's not really clear to me, from your post, what the exact issue is and what the exact reproduction steps are. Based on the information provided though, I am unable to reproduce any issues. I am not sure if this is our specific plugin that is causing your described behavior, or if it's something general that plugins can do. Have you checked if the data is really corrupt (in the database) or if it's just a visual glitch?

vervelover commented 3 years ago

Hi,

it's not easy to explain that's why I made a video. I am 100% sure there is a compatibility problem with Yoast SEO and ACF Pro though, so I wil try my best to explain what the problem is.

ACF PRO support told me to open a bug report with Yoast.

The data is sometimes lost, sometimes saved on the wrong place. I had data from acf custom fields being saved in the page title or yoast description. Definitely NOT a visual glitch. To reproduce this, you can download my acf exported fields and just do what I do in the video, or you can:

1) Create a flexible content field 2) Add 2 layouts: a text layout, a gallery layout 3) Create a new page 4) Add the text layout to the page, then the gallery, then save and reload. Add another text, another gallery, save and reload. Repeat until some fields disappear/are scrumbled. It takes 4/5 tries. In the video it's just 3 tries for a text to disappear, 4 for the gallery.

I tested it for 2 hours on a 100% clean wordpress install, with JUST acf pro and yost installed. If I uninstall Yoast, the problem is solved. But I can't live without Yoast.

The problem is on a higher scale with a flexible content inside a flexible content field (nested flex content). I had fields saved on the h1 page title with this, but it's longer to set up so reproducing the with the gallery field is enough.

Please let me know if something is not clear,

Thank you for your help, Alessio

SIDE NOTE: You need ACF PRO for this, not the free version of the plugin as it doesn't have galleries and flexible content.

Djennez commented 3 years ago

Did the ACF developers provide any information indicating why our plugin is the issue here? Any error messages in the browser console?

I am unable to use your import as it's not showing on any of my pages, so we'll need more detailed reproduction steps.

vervelover commented 3 years ago

Unfortunately this is what they wrote to me:

I would request you reach out to the Yoast SEO plugin support team regarding the issue as their plugin breaks ACF functional and hopefully they would shed more light on how to go about the issue as they are in a better position regarding the issue.

I asked if they could clarify, but since today is holiday I doubt they will answer before tomorrow.

My import is set up to show on a template called page builder, but you don't need it really, just edit the field and press update, so it will show on the default page template.

If you still have trouble with my import, you can follow the steps I wrote on the answer above instead, I wrote how to create the required fields. But it's easier to just update my imported field.

Djennez commented 3 years ago

Ok, I was able to reproduce the issue. The data does not seem to get lost, but it seems to be stored in a weird way in the database. Maybe the data gets split between post revisions and not retrieved properly. Unfortunately, we do not know how ACF handles their saving or retrieval of data, so we can't investigate this without spending a lot of time on it. So I think it's best if ACF looks into this problem, as its their functionality that seems to break.

It may have to do with our plugin hooking into the the_content filter on post save. I have seen more plugins tripping over this. I'd advice the ACF developers to look into that part first if they are going to investigate this. And if it really is an issue with our plugin, we're more than happy to assist in resolving the issue. But we'd first need to know why and how this is happening.

vervelover commented 3 years ago

Hi Djennez,

thank you for confirming this. I will report your answer to ACF PRO and report back

elliotcondon commented 3 years ago

Hi @vervelover @Djennez

Elliot here from ACF. I'm currently investigating the issue, but have not yet been able to successful replicate the bug. Please find a screen-recording of my progress, which seems to be working well at 17 layouts: https://www.loom.com/share/21db7953bf9f43aca4bba9cef6c15274

Running ACF PRO 5.9.4 and Yoast SEO 15.6.2

vervelover commented 3 years ago

Hi Elliot,

I've seen your video, you're missing one thing: you don't need to add so many galleries the first time (the more you have, the harder to spot if one disappears in the middle), and you only update the page twice. Just add two galleries with alternate text, save and reload, then 3, save and reload and so on.

On my video, you can see the bug shows only the third time I reload the page (you only reload twice in your video), and gets worse the fourth time.

Let me know if you're still unable to reproduce it,

Thank you for your help!

elliotcondon commented 3 years ago

@vervelover Thanks for the reply. I forgot to mention that I arrived at the 17 layout number by performing the same steps that you did in your original screen-recording: Adding 2 x content layouts + 1 x gallery layout. I did this ~5 times, saving a reloading the page after each edit.

I'll have another go at this today and see if I can replicate the issue. I wonder if the problem may be due to the AJAX save request on a live server timing out in some way. I'm using LocalByFlywheel on my local site which is incredibly fast.

Djennez commented 3 years ago

@elliotcondon I reproduced this on a local docker installation, that should be around the same performance as Local I think :)

vervelover commented 3 years ago

I'm experiencing this on a local xampp server setup on linux, but I noticed it got worse on a live shared server, it also is easier to reproduce with other plugins installed, so it may have something to do with server performance with the AJAX request. If you still can't reproduce it, I will export a heavier nested flex fields setup and share it.

Since it is a few years now that I've been using ACF pro + Yoast, I can say that I noticed some weird behaviour before even without flexible fields or galleries: sometimes the page title would become "-60". But that happened very rarely (3-4 times).

Just recently I discovered how great flexible fields are and started using them on all my clients projects, so I really hope this can be fixed.

Djennez commented 3 years ago

Is this still an issue on 15.9.1? We fixed a bug there that may have been a cause for this.

vervelover commented 3 years ago

Hi,

I tried the latest update, the bug doesn't happen at all with Google Chrome, it still happens with Firefox though. Maybe it was only a Firefox bug even in the beginning? I only tested with Firefox, I only realized I could test this with Chrome now and that could be the reason why Elliot from ACF could't reproduce the issue..

However, after the latest update saving pages is faster.