Support » Plugin: Attachments » Update / alter field values from code

  • Resolved IoanPokorny


    Hi, sorry to be bothering again, I really enjoy your plugin and it’s helping a lot on my projects.

    I have a question though, is there a way, existing function, code or anything so I can alter field values from the php file.

    for example as there is the $atachments->field(‘ANY_FIELD’) function to return the value for that specific field, I need to be able to complete my project to be able to change the value of a given field from php code ( field(‘field_here’)=’my_value’).

    How could I be doing this?


Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jonathan Christopher


    That seems like a strange use case for Attachments to be honest. It sounds like you’re trying to get around your issue of needing to dynamically set a field value based on something else your users are doing. I would suggest not using an Attachments field for this since they are intended to be manually populated by users and instead set up your own (hidden) post meta key that manages this field for you.

    I just want to be able to store some values in the fields

    I have made this function

    function fute($name, $valoare)


    if I call it as fute(‘field_name’, ‘value’), it stores the new field value and if I echo that field using your standard function it displays me the new value.

    The single problem would be what to do so I can store the new value in the database

    I need to dinamicaly populate a field of an attachment to set a value based on an activity a user does so I know it has been claimed by somebody.

    The only thing I would need for you is to let me know how to save the the value from the above function or do it another way if it’s appliable, not sure what else I could use as I need that field for any individual attachment.

    I really appreciate your work and it helps me a lot, I noticed that the premium version is not available, I can make a financial support to help you carry on with development but I really would need to be able to do that as your plugin offers exactly what I need and as it’s displayed using PHP I can arrange it in the exact layout I needd.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Update / alter field values from code’ is closed to new replies.