WordPress.org

Ready to get started?Download WordPress

Forums

Can't update custom fields (2 posts)

  1. cip6791
    Member
    Posted 2 years ago #

    Hello,

    I have a small problem with custom fields. This is what I am trying to do:

    - Whenever a new post is added, I check what category is selected, grab the sub categories and create custom fields based on the sub categories. Each custom field has a value of "0".
    - On each post I get the sub categories again and create checkboxes for each. When a submit button is clicked, if the checkbox is checked, the value of the custom field that matches the sub category is changed to "1". Then I check custom field values. If value is "1" some data displays, if value is "0" nothing displays.

    Everything works great. The only problem I am facing is for custom fields with more than one word. Ex. "Firefox" works, but if the custom field is "Firefox Browser" it won't update.

    Does anybody have any ideas why this happens?

    Thank you!

  2. cip6791
    Member
    Posted 2 years ago #

    This is my code:
    [Code moderated as per the Forum Rules. Please use the pastebin]

    As I said in my first post, Everything works great except for custom fields with two words. And I was doing a few tests, and if I set the custom field value to 1 manually it works. And when I uncheck the checkbox the script changes it to 0. But it won't change to 1.

Topic Closed

This topic has been closed to new replies.

About this Topic