Custom fields

10.71K viewsCorecustom fields

Pre-Sales question:

Can you add custom fields to each question form?


Yes you can easily add custom fields to AnsPress form, here is an example (this code is taken from category extension)

Hi, finally I couldn’t resist to try out v 2.x of anspress. I am having hard time to convert your provided custom field code sample (select categories) into my desired one. I am trying to display custom fields – 6 Options (checkbox + textarea / input type text). you see, basically I am trying to extend ask question page into “Ask Multiple Choice Question Page”. Trying to modify it since last night, but so far no success (Seems I am very much outdated with anspress). Can you please help me with that? Thanks.

Sir you are trying to make polling type questions ?

@kumar, yes (kind of)… and with the previous help from rahul (during making of anspress v 1.x), I have idea that I will have to add some Keys-Values like Option_01_Text, Option_01_isCorrect (and so on 02, 03…06), but I am unable to implement it.

I don’t have much idea of custom fields, Rahul will answer this.

@atultiwari, This means there will be a repetitive group of fields ? Then you have to save data in a meta table. This cannot be achived directly cause at the moment AnsPress form do not allow group fields, but very soon. Cheers!

@rahul, thanks for your answer. Then it’s better for me to wait, as I can’t code from scratch repeatedly for every new version 🙁 Even “saving these group fields into meta table and then display” are giving me more hard times than it was for v1.x. Thanks for this plugin though.

Hi Rahul, I am trying to customize the answer form so it would, instead of one text area, have a couple of them, something like this I managed to do this via shortcode while posting an answer, but what I would like is to make it as a part of template. So, referring to the question and answer/comments above, are there any updates about how to implement custom fields that could help me to achieve this? Thank you!


Hello, i need to upload image from question form. I have the solution code provided, but in that code how can i save files in database. the second function “my_save_pdf_uploads” need post id to create meta_key and save values. But it doesn’t work. Any help ?


Is it possible to upload files using Custom Fields?



I want to add extra custom field and text box in ask a question.


Also I want to know where my data is posted and how to retrieve.



Example is shown in below answer. custom fields data are stored as post_meta.