0

I try to insert around 2000 video-posts into WP. There is a custom field in the theme for the video-url, so I add the video-url to the post meta data with the corresponding field name. ACF seems not to be used by this theme (Edge, Journo).

This meta data shows up correctly in that field in the backend, however not in the frontend until I hit the update button for every post. After hitting the update button, everything works perfectly.

I tried so far:

  • wp_insert_post with a postarr containing 'meta_input'
  • wp_insert_post followed by add_post_meta
  • additional update_post_meta
  • additional wp_update_post
  • additional update_field
  • different versions of creating the post as a draft and then use wp_publish_post at different times

Does anyone know which functions excactly are triggered by the update button? Or other ideas?

Thanks in advance!

  • 2
    ACF is more than just raw post meta. If you want to set an ACF field value programatically you need to use its proper functions, eg. advancedcustomfields.com/resources/update_field Further questions should be directed to the plugin author/community, as 3rd party plugins are off-topic here. – Jacob Peattie Sep 21 '18 at 15:04
  • On a side note: WordPress by default parses a lot of different video links, not just Youtube. So you might not even need ACF if your video hosting site is in this list: codex.wordpress.org/Embeds – Michael Sep 23 '18 at 0:07
0

Thanks for your answers! Maybe I was a bit unclear, but I don't use ACF, it is just a field that comes with the theme.

However, this question and answers helped to find the problem: https://stackoverflow.com/questions/34018588/wordpress-add-post-meta-data-doesnt-display-on-page-until-post-is-manually

My WP metadata table entry was incomplete after creating a post programatically, the theme required another field. Saving the post again through the UI fixed that.

Using a plugin to display the meta data I compared the post's meta data after inserting the post and after hitting the update button, so I identified the missing value in the meta data..!

Hope this helps also for others with a similar issue!

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.