Hello!
I have a custom type with multiple relationships.
I would need the modified date of the custom type to be updated when the related custom types are updated.
how i can do this?
thanks
Nigel
Supporter
Idiomas:
Inglés (English )
Español (Español )
Zona horaria:
Europe/London (GMT+00:00)
You would need to use custom code to achieve this.
You can use the WordPress save_post hook (or, probably better, the more specific hook for your particular post type: https://developer.wordpress.org/reference/hooks/save_post_post-post_type/ ) to initiate the code whenever a post is updated.
Then use the toolset_get_related_posts API function to get an array of posts that are connected to the post that has been updated.
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
Then for each of these posts use wp_update_post to update the post so that the modified date is changed.
https://developer.wordpress.org/reference/functions/wp_update_post/