Support

Account

Home Forums Backend Issues (wp-admin) Many fields in a repeater : long saving times

Solving

Many fields in a repeater : long saving times

  • Hi,

    I am building some kind of custom CRM tool for my company, based on WordPress and ACF.

    From what I understood from this thread and others, having too many fields will cause long saving times, and even timeout issues* (I haven’t finished building my fields so I haven’t tested yet)

    Most of my fields will be located in a repeater, with about 50 fields in each row. I want to add more functions eventually so I’ll eventually get to 100 or even 150 fields. When I have 2 rows in the post, it will be fine, but as soon as I get to 5, 6 (regularly) or more than 10 rows (rarely), I’ll probably face serious performance issues.

    Question:
    I understand that the problem comes from the fact that, when a post is saved, WordPress checks each field individually, one after the other.
    => Wouldn’t it be possible to create a custom function that makes WP check each ROW of the repeater, and ONLY if there has been a modification in that row, check each field independently ? That would increase the performance dramatically.

    I’m not a developer so I would ask one to do it, but first I need to know if it’s even feasible.

    If not, is there any other solution that could help with this problem ?
    If not, I might have to rethink the way my tool is built, and separate different functions in different custom posts, instead of having it all in a same custom post. A solution I don’t really like, but better than having very long saving times.

    Thank you in advance !

    *On another thread, John Huebner mentions that Gutenberg might help with this issue, so I don’t even know if the problem still remains nowadays.

  • That is a very old topic, I’m sure there are newer ones.

    I don’t see where I mentioned guberbug in that topic so you may mean a different one. If I did mention that then it would have had to be before the new editor was added and I don’t use it. It’s not likely that it will help unless you can use block for everything.

    With that number of fields I would defiantly look at a different way to build it.

  • Hi John,

    Thank you for your quick reply.
    You mention Gutenberg in your 4th reply of the thread on January 29, 2018.
    But it doesn’t matter, I don’t use Gutenberg either, I just mentioned this in case there had been some changes to WordPress since then that makes my problem now irrelevant. Obviously not the case.

    With that number of fields I would defiantly look at a different way to build it.
    I fear this is what I’ll end up doing. Using a repeater is very justified considering what I’m building, but I’ll probably have to separate some functions in different posts types. Not ideal at all, but better than the alternative.

    Before resorting to that solution, I’d like to ask if the solution I thought of could potentially work :

    – Create an additional field in the row (lets call it rowmodified)

    – When there is any change in any field of the row, have a value (for example “1”) added dynamically in the field rowmodified.

    – Add a function that does the following when the post is updated:
    * Start by checking/saving the value of rowmodified in the first row of the repeater.
    * if rowmodified has a value of 1, insert/update the other fields of the row. THEN delete the value of rowmodified.
    * if rowmodified has no value, don’t check/update the other fields of the row (i suppose this is the tricky / impossible part)
    * On to the next row
    * Update the remaining fields out of the repeater.

    As I said I’m not really a developer so i have no idea if it is technically possible, I suppose not, but who knows.

  • This will not work, as far as I am aware there isn’t a way to make ACF move onto the next row of the repeater. No hooks that I know of in the loop that would make it continue on to the next item.

    If there is any way to do this it is complex enough that I haven’t been able to figure it out. Trust me, if I could I would because I have issues with flexible content fields.

  • I trust you 🙂
    I had read enough threads on the subject to guess that it was almost impossible to fix, but I wanted to make sure.

    Ok, then I have some questions on how to optimize my fields (to try and reduce the number of them), but I will create a separate thread for that.

    Thank you very much John

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.