NextGEN Custom Fields
[resolved] Set field value by a function (3 posts)

  1. tricks
    Posted 4 years ago #

    Is it possible to set a field value directly via a php-function instead of via the WP Dashboard?

  2. shauno
    Plugin Author

    Posted 4 years ago #

    Hey tricks

    Unfortunately this was actually my first released plugin, and I hadn't got into the habit of breaking EVERYTHING down into the simplest APIs.

    That being said, inserting directly into the table is pretty simple. Have a look at the nggcf_save_pics() function for a basic idea. It takes all the pictures when saving a gallery in NGG and loops through them INSERTING or UPDATING wp_nggcf_field_values.

    Essentially the fields in wp_nggcf_field_values are:

    • pid - The picture's ID
    • fid - The custom field's id (from wp_nggcf_fields)
    • field_value - The value string
    • dateadded - Just a timestamp (date('Y-m-d H:i:s', time()))
    • ngg_type - The constant numeric 1 for images (2 is for gallery custom fields)
  3. tricks
    Posted 3 years ago #

    Thanks for your quick reply. Sorry I forgot to reply myself. Issue has been solved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • NextGEN Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic