Wordpress custom fields not saved in database - wordpress

I've been running a WordPress site for over a year now and never had a problem with it until yesterday. I'm using a custom field to store the url to a preview image for every post. I simply add it using the standard Custom Fields form in the Edit Post screen. Before when I'd save the post as a draft or if I immediately published it the custom field would be saved. But now all of a sudden no matter how I save the post (save as draft, publish or auto-save) the custom field isn't being stored in the database. I did confirm this by checking the wp_postmeta table.
I already reinstalled Wordpress, but it doesn't change a thing. I also went through other similar posts about this subject, but none of the solutions work.
Any ideas?

So after digging deeper, I figured out the custom field was dependent on another field. Still not sure why it wouldn't store the custom field in the database even though the other field wasn't filled out first. But it works anyway when I do it that way. WordPress works in mysterious ways sometimes.

Related

ACF Fields missing after migrate but website works fine

I have recently migrated my DB to a staging environment using string find and replace on the DB to rename the domain. This has made the ACF fields in the CMS to go missing.
That page should have several fields available. And while the fields are showing in the pages that ACF group is assigned to I can't edit or see them here any more. I can't even create a New ACF group because I can't see the Add Fields box.
The website works fine, the only issue is the fields cannot be edited anymore.
Any ideas?
Solution:
Go to your DB, open table usermeta, find your user and delete the field acf_user_settings

WP Advanced Custom Fields data after import

I imported Custom Fields into my WordPress site from my staging server. Certain pages are no longer working.
I've tracked this down to a data issue. I went into the database and removed all entries from the wp_postmeta table that I am referencing on my page that is failing. I then went back into a post that was not working and did an update. That post now works.
This isn't a realistic approach since there are hundreds of posts that I would have to manually update. Any ideas on what I can do?
I figured out that each revision is stored in the database.
The original developer of the site i'm working on was displaying fields incorrectly.
If a field was called list_items, they were saying post.list_items instead of post.get_field('list_items'). Since there were multiple revisions in the database the DOM was displaying an array.

ACF - Template Assignment Seems Permanent

I've been using the Advanced Custom Fields (ACF) plugin for quite a while now. It's absolutely awesome but I'm experiencing some behaviour that is not the norm.
I've noticed that if I change the page template that is assigned to a set of custom fields, the pages that ran off that template (no longer assigned to those fields) effectively holds onto those custom fields and thus renders correctly on the site.
E.g.
ACF Partner Fields are assigned to a Partners Template that has a number of pages running of it.
If I assign these fields to another template, all of the pages running of the Partners template, still render correctly.
I'm not sure I've ever experienced that before and it is causing issues with another plugin that is being integrated for translation.
Any ideas what might be happening?
All time and help is appreciated.
When you change the template, your only changing where those fields appear on the backend and what post type or location they write to in the database. The database table for those unassigned posts still contains the information form those ACF, they just won't be written to any longer.

Poll type form in Wordpress?

I'm looking for a way to display simple poll type survey on dedicated page, but haven't found an answer to this problem for 2 days now.
Survey needs to have text and dropdown fields, also answers must be visible to logged-in members and must be editable by admins.
Any ideas?
Edit:
Ok I found a Beta plugin called Extra Comment Fields that should work, but I'm having trouble with the database! Extra fields are not stored anywhere! Table this plugin uses (and should create) is called wp_comments_extra, but this table is nowhere to be found. Is there any way to manually crate correct table by backwards- engineering plugin's .php file?

Wordpress - How to create a fav posts feature

I want my users to be able to mark posts as favorite. I tried the wp-favorite-posts plugin, but it doesn't work. I mark posts as favorites and after refreshing the page it's all gone. Furthermore, if I put {{wp-favorite-posts}} to a page, it just shows the text.
So I want to create my own solution, but don't really know how. I have never edited the WP database, but I have plenty of PHP mySQL experience.
Can anyone please point me in the right direction ?
You can use post_meta. You can store the "favourite" aspect as a custom field attached to each post. You don't need to manually edit the database (i.e. via mySQL).
When you want to show the favourited posts, run a custom query that only shows posts with the specific custom field that you've specified.

Resources