Skip Navigation

[Resolved] Set category/tag based on date field with cron task

This support ticket is created 4 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

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 1 reply, has 2 voices.

Last updated by Minesh 4 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#1992849

Tell us what you are trying to do?

I have a toolset custom date field that holds information when the product price was updated by the shop owner. When this date is over a year ago (compared to today's date) then I want to add a certain tag or category. The check should be done daily on all products with a cron task.

Similar to this: hidden link

Can you guide me in the right direction on how to achieve this?

Thank you,
Thomas

#1993341

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

This is a custom code that is beyond the scope of our support policy.

But if you want how you can set the default term for you post, you can use the standard WP function: wp_set_object_terms()

wp_set_object_terms($post_id, $post_terms, $taxonomy);

Where
- you can replace all function argument with your original variables.

More info:
- https://developer.wordpress.org/reference/functions/wp_set_object_terms/
- https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/