WP Plugins and Custom Fields

Date: 5th November 2007 at 9:14 pm | Filed under: development, scripts, wordpress | Author: Sam Burdge

This article is intended to address issues involving the use of add_post_meta and delete_post_meta in WordPress plugin design. These functions can be used to add or delete custom fields for a post, useful for plugin design as the value for the custom field can be entered via a form in the write page. The add_post_meta code would look something like this:

Read on…

5 Responses to “WP Plugins and Custom Fields”

  • Comment by johnbillion
    Date: December 6th, 2007 at 5:45 pm

    Erm, have you tried update_post_meta ?

  • Comment by Sam Burdge
    Date: December 10th, 2007 at 2:20 pm

    Hi Johnbillion,
    update_post_meta is a tidier way, true. But the problem still remains that if you hook it in using add_action as stated above, there will be instances where the function is called even though the form hasn’t been submitted (i.e. the post/page hasn’t been edited), like when a comment is approved.
    Sam

  • Comment by WP Plugins and Custom Fields | Sam Burdge | Squico
    Date: August 19th, 2009 at 4:40 am

    [...] In: Wordpress plugins 19 Aug 2009 Go to Source [...]

  • Comment by Gvnah
    Date: January 21st, 2010 at 9:29 pm

    hi, i hope this post is still being operated. I’m trying to add a custom field value to all my old posts.. (i want the old posts to have the same value though [same thumbnail])

    I just re-designed my wordpress blog’s theme and the new theme uses custom value to insert thumb-nails..

    the problem is that.. i already have old posts that i want to insert the thumbnails

    could anyone help PLEASE :)

  • Comment by David
    Date: November 10th, 2010 at 7:08 am

    This page is really tough to read with the intense contrast. You might want to make the white a little less bright. Good blog though!

Leave a Comment