Is it possible to add custom meta key and meta value in wordpress post from a custom post type? I’ve tried to research everything in google but still no luck. Do you have any ideas guys? thanks
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s possible to add custom meta data in WordPress pragmatically using add_post_meta function
For example if you want to add meta data with key name
ageand value25to post with id10then you can do it likeIn above example, a meta key with
ageand value with25will be added to the post id10and also you can use it in your template using get_post_meta function likeAbove line of code will get
agemeta value from post id 10, which is25, so you can print it in the template asUpdate:
Just add this in your
functions.php