Support

Account

Home Forums General Issues meta_key duplicated on post save

meta_key duplicated on post save

  • Hello,

    I’m using the free acf and the purchased repeater field plugin. They are most excellent; I’m probably never going to develop any other way again now that I have found wp + acf.

    Kudos aside, I have an interesting problem and would like help trying to figure out what is happening. In a nutshell, I’m seeing duplicate meta_keys for some of my custom fields.

    A bit about where I’m seeing it (and where I’m not). I have a TEST and a LIVE site. In TEST I create my custom fields, I export them, php style, save them into an acf.php, and include that via the LIVE configuration. It’s working very well.

    I am not seeing this in TEST. I am only seeing it in LIVE, if that is a consideration that ACF is being driven by the acf.php. In fact, let me include a snippet of the acf.php for one of the meta fields that is being duplicated:

                            array (
                                    'key' => 'field_52ccb21266722',
                                    'label' => 'Estimated Value of Auction Item',
                                    'name' => 'auction_estimated_value',
                                    'type' => 'number',
                                    'required' => 1,
                                    'conditional_logic' => array (
                                            'status' => 1,
                                            'rules' => array (
                                                    array (
                                                            'field' => 'field_52bc856a5d6b9',
                                                            'operator' => '==',
                                                            'value' => '1',
                                                    ),
                                            ),
                                            'allorany' => 'all',
                                    ),
                                    'default_value' => '',
                                    'placeholder' => '',
                                    'prepend' => '$',
                                    'append' => '.00',
                                    'min' => '',
                                    'max' => '',
                                    'step' => '',
                            ),

    The only thing I can think of that might have caused this to happen in LIVE rather than TEST is that I made an error during an sql client query session whereby I accidentally set all the parent_id’s of the wp_post table to the same value. I “undid” this by finding the same values from the TEST.wp_post table and updating LIVE accordingly. Still, in the back of my mind, I wonder if this is my problem.

    Another theory I’ve had has to do with author permissions or write locks. I don’t know enough about wp; unfortunately, but I believe I have scientifically ruled this out by repeating the duplication of meta_keys with with user that is the post_author.

    In closing, let me also mention that it’s not just one meta_key that gets duplicated, nor does it appear to be all of them. It does, though, potentially have to do with a group of fields that are all using logic to become required.

    Let me know what other information or test results I might provide to help uncover what I’m doing wrong.

    Thx,
    jj

  • ah, an attachment button! here is the entire acf.php.

  • Hi @larjohns

    Please note .php files are not allowed to be uploaded, please zip the file and try again.

    As for the issue. This may be caused by your included PHP conflicting with existing fields in the LIVE database.

    If you only wish to use the PHP fields on the LIVE site, can you please delete all field groups from the LIVE site?

    Let me know if this fixes the issue.

    Thanks
    E

  • Aha, that makes perfect sense. I wondered how best to clear out the fields i had manually set. Can you point me to an example query that I can use to do that, please? Or are you sugggesting that I just delete them out from the ACF panel (I have it set to ACF LITE, so there isn’t one, but i could undo that).

  • Had a similar problem early on. But the most recent update (4.3.3) seemed to resolve the issue.

  • interesting…i just updated the TEST env to 4.3.4, LIVE, where the problem is, still has 4.3.2. maybe i’ll just ignore it until the updates roll out. thanks for the comment, realph.

    ———————————

    anyway, some users may find it interesting that i found that even in ACF LITE mode that one can raise the dashboard, the field groups list, by accessing

    //WordPress/wp-admin/edit.php?post_type=acf

    that isn’t my entire problem, i guess, since there are no fields listed in the field group.

    here is a dump of the meta_keys and values for the post that i can replicate the duplicate key issue on:

    
    meta_key	          meta_value
    auction_min_bid	          5000
    auction_start_datetime    1389052800
    is_auction	          0
    _auction_close_datetime	  field_52bca098b5d6a
    _auction_estimated_value  field_52ccb21266722
    _auction_min_bid	  field_52bca121b5d6b
    _auction_start_datetime	  field_52bca011b5d69
    _is_auction	          field_52bc856a5d6b9
    

    it seemed to have been only the auction fields that duplicated…also i’m reattaching the acf.php as a zip.

  • Hi @larjohns

    Thanks for the follow up, but looking at your pasted data, I can’t see any ‘double’ up at all.

    Thanks
    E

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

The topic ‘meta_key duplicated on post save’ is closed to new replies.