Remove rows with empty fields

Support General Remove rows with empty fields

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #38547
    info@ceescoenen.nl[email protected]
    Participant

    Hi all, today I cleanup my custom fields and database. I have one group of fields that I have used where the field 'distance' on 80% of the posts is empty. I remove the custom field to another custom field group so that I can specify exact the posts where I have to set the distance.
    Is it safe to remove all the rows in the database where 'distance' is empty?

    And second: is it safe to remove all rows in the postmeta where meta_value is empty?

    #38550
    Long NguyenLong Nguyen
    Moderator

    Hi Cees,

    FYI, WordPress does not support saving an empty value to the database. If a field (for example text) has a value then you delete it when editing the post and save changes, the current row will be deleted in the database.

    #38551
    info@ceescoenen.nl[email protected]
    Participant

    That is strange. I see it now when I add a new record with empty fields. But I have records that have a empty fields. A lot.

    I / You have do a migration from ACF to Metabox 1.5 years ago, first manually later with the new tool. Can that be a reason? See image

    https://imgur.com/a/uCS6tmv

    #38555
    Long NguyenLong Nguyen
    Moderator

    Hi Cees,

    It looks like the result of a SQL query, not the table wp_postmeta which you can see here https://codex.wordpress.org/Database_Description#Table:_wp_postmeta

    But somehow the empty values are stored in your database, you can safely delete those rows as well. You can also test to save an empty value to the database and recheck this case.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.