• Resolved maddownload

    (@maddownload)


    Hi
    When copying a post for translation I would also like to copy custom fields that come with it. Is it possible with Multilingual Press. I’d be even interested to pay for this feature as copying many custom fields that are already filled in one language version to the other takes a lot of time

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there,

    yes, it is possible to copy (just copy, not actually individually translate) custom fields or metadata. You just have to provide a map of key—value pairs and add it to the mlp_pre_save_post_meta filter.
    Add an entry for every meta value that you want the translation posts to have, with the key being the according meta key. You can get the original post ID via the second argument that gets passed to the filter (i.e., $save_context['real_post_id']), and thus fetch the original meta values.

    I hope that helps.

    Cheers,
    Thorsten

    Thread Starter maddownload

    (@maddownload)

    Hi, thank you for your answer, Thorsten
    For custom fields I use the plugin called WordPress Meta Data Filter & Taxonomies Filter https://wp-filter.com/ Wouold you give me example how I do go about setting this up?
    Tomasz

    I don’t understand. What is it that you want to set up?

    The above filter takes an array of meta keys as keys and meta values as values, so you have to define the keys of the metadata you want to copy, then loop over it and get the values of the original post (the ID is stored in $save_context['real_post_id']).

    That’s all, basically.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Fields Copying’ is closed to new replies.