Sauter la navigation

[Résolu] User id as title

This support ticket is created Il y a 4 années et 11 mois. 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Luo Yang Il y a 4 années et 11 mois.

Assisté par: Luo Yang.

Auteur
Publications
#1623287

Hi,
is it possible to use the current user id (or name) as title of new created Toolset CPTs posts?

Thanks

#1623943

Hello,

There isn't such kind of built-in feature within Toolset, it needs custom codes, for example:
1) when user save a "CPTs" post, use action hook "save_post" to trigger a PHP function:
https://developer.wordpress.org/reference/hooks/save_post/

2) In this PHP function, get the current user's ID:
https://developer.wordpress.org/reference/functions/get_current_user_id/

And save it as post's title:
https://developer.wordpress.org/reference/functions/wp_update_post/