0

i added a new field (property_second) to the admin area of the theme. and i want this field value to be the same as the post title. so if the post title changes, let it change here. how can I do it?

array(
            'key' => ERE_METABOX_PREFIX. 'property_second',
            'value' => $keyword,
            'type' => 'CHAR',
            'compare' => 'LIKE',
        ),
1
  • 1
    Are you asking how to store the post title in a meta field, or how to update that meta field if/when the post title changes?
    – Pat J
    Mar 8 at 1:37
0

Hook into the post status transitions and copy the post title to your secondary field. See documentation:

https://codex.wordpress.org/Post_Status_Transitions#transition_post_status_Hook

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.