Home Forums Backend Issues (wp-admin) Many custom fields in a post : optimize performance Reply To: Many custom fields in a post : optimize performance

  • Hi @hube2

    Sorry, following your last comments I thought of another solution.

    So I have many, many subfields in my repeater. Most of these fields are “secondary” and belong to a group that is hidden via conditional logic.
    When I want to check/edit these secondary fields, I click on a true/false located outside of the repeater.

    When I’m done editing, I will usually want to hide them again via the true/false to keep only the essential information. But of course if i forget to save the post before hiding the fields, they won’t be updated.

    I thought of a solution that is clearly a hack :
    – When clicking on the true/false to TRUE, it adds a css class that hides it (so it can’t be clicked back to FALSE)
    – When done editing these secondary fields, the user saves the post. Via a custom function, the true/false value is returned to FALSE after save.

    Is it a bad idea ?

    As for your comment about reordering rows of a repeater when some fields are hidden by conditional logic I thought of something similar :
    – I hide the reordering column via CSS
    – I add a true/false, that when clicked to TRUE :
    *Becomes hidden via CSS
    *Displays the reordering column vis CSS
    *Displays all the hidden fields via conditional logic
    – I reorder the rows. Again I can’t click back to FALSE, So I save the post, which would put the true/false back to FALSE.

    By doing this I solve the performance issues (secondary fields would only be updated in the DB when needed) and the issues caused by repeater and conditional logic that you mentioned.