• Resolved michaelw90

    (@michaelw90)


    This looks like a great plugin, but I have a question I did not manage to figure out.

    From what I’ve understood the default behavior is that the plugin deletes existing content of the custom field with whatever you write in the text field. I need to add a short string of text to the end of every field, is this possible?

    Every field has content something like this:

    2013/02
    2011/09
    2014/04
    etc.

    I need to just add /01 after every one of these…

    https://ww.wp.xz.cn/plugins/custom-field-bulk-editor/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author sparkweb

    (@sparkweb)

    Appending post meta isn’t a function that WordPress supports so it would actually be something custom. The plugin doesn’t support that, so I think your best bet would be to hop into the database and do it. It wouldn’t be too hard to build a little bit of SQL that would do it.

    UPDATE wp_postmeta SET meta_value = concat(meta_value, '/01') WHERE meta_key = 'your_target_key';

    I think that would do it, but obviously this hasn’t been tested so tread with caution and maybe backup first. 🙂

    Thread Starter michaelw90

    (@michaelw90)

    I’ll definitely test this out, thank you so much for helping me out.

    I’ll let you know if it works out, maybe someone else’ll be wondering the same 🙂

    Thread Starter michaelw90

    (@michaelw90)

    I can confirm that this worked for me, I also had to use the following line to remove all ‘/’ so I could save the date in YYMMDD format.

    UPDATE wp_postmeta SET meta_value = replace(meta_value, '/', '') WHERE meta_key = 'your_target_key';

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Add string to existing content’ is closed to new replies.