Add Custom Fields to all posts

Hi

I am trying to write a plugin to add custom fields called “Expiry Date” and “Expiry Time” to my posts when the post is created.

Can someone please point me in the correct direction for this.

Thanks.

I usually use my functions.php file to code things like custom fields, because my clients don’t need the flexibility of a plugin, but the concept is the same. Did you try the WordPress documentation - it is usually very helpful. For example, https://codex.wordpress.org/Custom_Fields

HI
I looked at that and I’m not seeing where I can add my 2 custom fields for each post I create.
I am seeing where I can add it to each post at a time.

Down near the bottom of the page it talks about custom meta boxes. Those are input boxes that you can add to the post edit page. If you Google “WordPress Custom Meta Boxes”, you will find some good tutorials showing you how to code these, if you don’t want to use the WordPress documentation. Just be careful when you choose the tutorial that you use a good quality one.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.