WP Advanced Custom Fields data after import - wordpress

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.

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

why I am having to create categories or pages everytime - Wordpress.?

In one pc I create categories or pages or any custom fields in wordpress. I commit and push this code. But when I fetch the same in another pc, I 'll have to create all those pages or categories or custom fields again which I created in 1st pc which is a headache and time consuming. Do we need to set anything first time or is there any way to avoid all these. I don't want to create those fields again.
Any help would be greatly appreciated.
Wordpress is not saving the categories, fields, pages as files. It saves them in database. So your commits/push won't work there, you have to update your database as well.

create a post in Wordpress with an external script

I am making a java script to create a few posts in a Wordpress blog by only inserting them into the wp_posts so table. So far I could browse the posts on web browser. Question is, is it good enough with the db operations ? does anyone know any other subsequent tables need to be updated for making a post ?
Not really, you can extend the default and existing WordPress posts.
But you can go ahead and create your own table like: https://github.com/wp-plugins/wordpress-guest-post/blob/master/wordpressguestpost.php
ended up adding REST API V2 plugin and make calls to it for creating all sorts of things. Worked like a champ

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.

Wordpress custom fields not saved in database

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.

Resources