Skip Navigation

[Resolved] Custom field not being populated consistently

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by Minesh 2 months, 1 week ago.

Assigned support staff: Minesh.

Author
Posts
#2465153

Hi Support

We have noticed that on our custom Post Type "Nanny Ads" in our Production environment that the custom field wpcf-nanny-ad-expiry is not being populated consistently and correctly. A similar query on dev does not exhibit the same behaviour.

I ran the following SQL on our database to check the field contents:

SELECT p.id, p.post_title, pm.*
FROM `wp_posts` p
left join wp_postmeta pm on p.id = pm.post_id
WHERE post_type = 'nanny-ad'
and pm.meta_key in ('_cred_post_expiration_time','wpcf-nanny-ad-expiry')
order by pm.post_id, pm.meta_key

Each language pair should have both fields _cred_post_expiration_time and wpcf-nanny-ad-expiry filled with the identical timestamp value.

So for example, a user creates an Ad in English. On submission, its language duplicate is created in German. So we should have 4 records per Ad returning from the query.

I checked for custom post type Job Ad which works similary, and there we have a perfect match every time.

I cannot see any reason why it should not be working for CPT Nanny Ad perfectly every time too.

Some specific things that may be of interest:
- The Nanny Ad is created using Toolset Post Form "Post Form - New Nanny Ad (ID: 921)"
- there is a custom code snippet "preserve-ad-expiry-date", but it looks OK to me, but I'm not a PHP expert.

Could you please have a look and try to ascertain why this field is not being populated consistently?

If you need to create any Ads in our Production environment (hidden link), please give them a Title like "TEST AD, PLEASE DO NOT REPLY". Please also set "Visible for Families" field to No, so they are hidden from the families searching in Production. Also if you need to install a DB plugin, please do so temporarily.

Thanks and regards
Simon

#2465521

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You said that the post expiration field "_cred_post_expiration_time" value do not copy to the translated post - is that right? If yes:
- What if you navigate to:
- WPML => Settings => Custom Fields Translation => click on the link "Show system fields" and then try to search for the field "_cred_post_expiration_time" and set it to copy.

This will copy the field value of custom field "_cred_post_expiration_time" to translated post - Does that makes sense?

#2466495

Hi Minesh

Thanks for your reply.

I see the logic of your answer, however I didn't implement your suggestion just yet for the following reasons:
1) it is working fine for our CPT Job Ads, even with the system field "_cred_post_expiration_time" not set to copy.
2) It works/worked for some Nanny Ads but not others. I cannot find any logical reason why some Ads are working but others not.

I'll do another query on the database to include the language code of the records, perhaps that might help us to get some clue as to why it works fine for Job Ads, but only sometimes for Nanny Ads.

Kind regards
Simon

#2466541

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

2) It works/worked for some Nanny Ads but not others. I cannot find any logical reason why some Ads are working but others not.
==>
Can you find out that all those Nanny Ads which works/worked does have correctly set the "_cred_post_expiration_time" field with correct values.

Can you pleases findout on what case its not working and the difference between the database values for fields for Nanny Ads which works/worked and not working.