shaadamin44 Posted September 10, 2021 Share Posted September 10, 2021 Hi there, I've some existing post with wordpress custom field. I can create post with custom feild but now I want to update their custom field. How Can I get the post using Post Title & update their custom field data? Can anyone help plz? Quote Link to comment https://forums.phpfreaks.com/topic/313697-programmatically-update-custom-field-for-existing-posts-in-wordpress/ Share on other sites More sharing options...
dodgeitorelse3 Posted September 10, 2021 Share Posted September 10, 2021 What have you tried so far? Quote Link to comment https://forums.phpfreaks.com/topic/313697-programmatically-update-custom-field-for-existing-posts-in-wordpress/#findComment-1589791 Share on other sites More sharing options...
jarvis Posted September 13, 2021 Share Posted September 13, 2021 If you create a loop for all your posts, you could then use 'get_page_by_title' within the loop. This will return the post ID. Once you have the post ID, you can then use 'update_post_meta' Obviously, it would depend what you're trying to update the custom field with. Are you not able to simply edit the post via the admin area? Quote Link to comment https://forums.phpfreaks.com/topic/313697-programmatically-update-custom-field-for-existing-posts-in-wordpress/#findComment-1589877 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.